Nov 05, '03 10:45:00AM • Contributed by: KOHb
- 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:
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.ignoring application responses tell application "Terminal" activate do script "" end tell end ignoring
- 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!
