|
|
Use Terminal's vi as default text editor
Regarding your problem that "Unfortunately, the one thing I haven't figured out is how to get it to open without an input file, so to start a new text file I have to go to the Terminal and type vi filename. Please let me know if this script can be improved to handle that case, or in any other ways. "
It is easy to have your VI application also open by double clicking. You just have to put in there a similar AppleScript piece of code with "on run", as well as "on open inputfile" and do the appropriate adjustments. You would end up with something the following (which seems to be working for me). on run ---
Use Terminal's vi as default text editor
or one better, add an input for a file name/path:
on run
display dialog "Enter file name:" default answer "filename"
copy the result as list to {theFilename, theButton}
ignoring application responses
tell application "Terminal"
activate
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
do script "vi " & quoted form of fileName in selected tab of the front window
end tell
end ignoring
end run
on open inputfile
ignoring application responses
tell application "Terminal"
activate
tell application "System Events" to tell process "Terminal" to keystroke "t" using command down
do script "vi " & quoted form of POSIX path of inputfile in selected tab of the front window
end tell
end ignoring
end open
Re: Use Terminal's vi as default text editor
When I'm writing an applet that duplicates a lot of code in its For example,
There's probably a way to eliminate the |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.06 seconds |
|