Run scripts via the Script Menu via keyboard

Mar 21, '08 07:30:04AM

Contributed by: philostein

I work with image files and I have many scripts and Automator workflows to handle and modify them. Lots of these actions are assigned to Quicksilver keyboard shortcuts, as I hate using the trackpad. Unfortunately it's difficult (for me) to remember all the keys, and I'm also running out of keyboard! So this tip assigns a keyboard shortcut to the script icon in the menu bar, and allows you to easily select the scripts/workflows within by keyboard. It will work with most apps.

First, open AppleScript Utility in /Applications » AppleScript, and activate Show Script Menu in menu bar and Show application scripts at: top. Then, holding Command, drag the Script icon in the menu bar as far left as you can (it won't go past certain installed apps' icons).

Next, in the Keyboard Shortcuts tab of the Keyboard & Mouse System Preferences panel, enable (and change if desired) the shortcut for Move focus to status menus in the menu bar (in the Keyboard Navigation section; I used command-F2). This shortcut will now open the Scripts menu (because it's leftmost) first from within most apps.

Download Add Front App to Menu.scpt. Open the script. This creates a folder for Script Editor in ~/Library » Scripts » Applications. Then move the Add Front App to Menu script to ~/Library/Scripts. Using the menu bar script menu, you can now add a script folder for any frontmost app to ~/Library » Scripts » Applications. Let's add the Finder first. Make sure Finder is frontmost, then run that script from the Scripts menu.

Now (nearly there) copy some Finder-friendly scripts or workflows to ~/Library » Scripts » Applications » Finder, and rename them so the first character of each is unique. This way, when the menu bar script menu is open, you can highlight the right script with just one key press. If you have lots of scripts starting with the same word or letter, put a different number at the front of each filename, e.g. file-jpg.scpt and file-png.scpt become 1file-jpg.scpt and 2file-png.scpt. Now you can run any number of scripts or workflows in just three key presses -- and without having to remember lots of shortcuts. Happy button pushing!

Comments (15)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20080315064646576