Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Sgarc

macrumors newbie
Original poster
Aug 23, 2008
1
0
Arkansas
I use Vi a lot having to open the terminal --> Vi "Desktop/newfile.txt." got old fast. So I wrote this script

tell application "Terminal"
try
do script "vi Desktop/new.txt"​
on error
display dialog "Try Again"​
end try
end tell

works great. Well having to end the terminal session when I am done with Vi is well "old."
I am trying to write a script that will read keystrokes that when I enter ":q!" to end Vi will end the terminal session as well
so far no luck here is what I have so far.

tell application "Terminal"
try
do script "vi Desktop/new.txt"​
on error
display dialog "Try Again"​
end try

set input to keystroke
repeat until input = ":q!"
set input to keystroke​
end repeat
quit "Terminal"
end tell

any ideas?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.