10.3: Use keyboard shortcuts to run arbitrary applications
Nov 05, '03 10:45:00AM
Contributed by: KOHb
I like to have a shortcut key to open up a new Terminal window or xterm. When I upgraded to Panther, iKey, which I'd used previously for this, didn't work for me, and Another Launcher was overkill. However, you can use the ScriptMenu and the Keyboard Shortcuts to achieve the same effect.
- Enable the script menu by executing (from the Terminal, or via the Finder in /Applications -> AppleScript)
open "/System/Library/CoreServices/Menu Extras/Script Menu.menu"
- Create a script to do what you need using AppleScript Editor. My script (Terminal.applescript) looks like:
ignoring application responses
tell application "Terminal"
activate
do script ""
end tell
end ignoring
You can modify the script as you need. For example, removing the do script line and changing Terminal to another application will just start another application.
- Compile the script (save it as a script with AppleScript Studio; it gets the extension .scpt) or use osacompile -o Terminal.scpt Terminal.applescript
- Move the script to your ~/Library/Scripts folder; it should now appear as one of the scripts.
- Go to the Keyboard & Mouse Preference Pane and add a keyboard shortcut for all applications for "Terminal."
- Login and logout and voila, arbitrary command run by keyboard!
Now if I could only get Terminal windows to arrange themselves more intelligently (place themselves in open space)...
Comments (32)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20031031163544980