Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Run scripts via the Script Menu via keyboard System
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!
    •    
  • Currently 2.38 / 5
  You rated: 4 / 5 (8 votes cast)
 
[28,380 views]  

Run scripts via the Script Menu via keyboard | 15 comments | Create New Account
Click here to return to the 'Run scripts via the Script Menu via keyboard' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Run scripts via the Script Menu via keyboard
Authored by: diamondsw on Mar 21, '08 08:55:39AM
If you need this kind of functionality, Butler would probably be a better option. It allows customized menus to be created with key shortcuts and many other triggers.

Of course, the real solution here would be for Apple to fix the Keyboard preferences pane so we can just apply shortcuts to items on the Script menu from there...

[ Reply to This | # ]

Run scripts via the Script Menu via keyboard
Authored by: philostein on Mar 21, '08 02:40:40PM

I do use Quicksilver for lots of shortcuts, but I like having quick access to frontmost app-relevant scripts without having to remember the key combos!
Also, I like that this method uses the system and requires no extra processes running.



[ Reply to This | # ]
Run scripts via the Script Menu via keyboard
Authored by: dsjkvf on Mar 23, '08 01:52:20AM
you may use Quicksilver's corresponding proxy to access any menu item.

[ Reply to This | # ]
Run scripts via the Script Menu via keyboard
Authored by: philostein on Mar 23, '08 03:18:17AM

I truly love the Quicksilver 'Current Application' proxy, and I would love it even more if you could show me how to access the script icon menu to the right of the menu bar - and not just the current application menus...



[ Reply to This | # ]
Run scripts via the Script Menu via keyboard
Authored by: iJak@mac.com on Mar 21, '08 09:04:07AM

I tried all three versions of this hint on Safari Version 3.1 (5525.13), Mac OS X 10.5.2.

I like all three, and will use one, or another whenever I need, depending on which comes to mind first. ;-)

---
50% of all the people on this planet are below average in I.Q., even Americans.



[ Reply to This | # ]
Run scripts via the Script Menu via keyboard
Authored by: deef on Mar 21, '08 09:28:01AM

I don't get why the Applescript is needed. Couldn't one accomplish the same thing by manually creating the folder and enabling the keyboard shortcut in prefs.?



[ Reply to This | # ]
Run scripts via the Script Menu via keyboard
Authored by: deef on Mar 21, '08 09:29:09AM

I don't get why the Applescript is needed. Couldn't one accomplish the same thing by making the changes in Applescript Utilty, manually creating the folder and enabling the keyboard shortcut in prefs.?



[ Reply to This | # ]
Run scripts via the Script Menu via keyboard
Authored by: philostein on Mar 21, '08 03:36:27PM

Thanks deef, this works! But you have to add a script to the folder for it to show up in the script menu.

The good thing about the 'Add Front App to Menu.scpt' is that it saves a lot of folder navigation (and typing). It also creates a script to allow quick access to the said app's new script folder. That's why I like scripts - they do the work for you. ;)



[ Reply to This | # ]
Run scripts via the Script Menu via keyboard
Authored by: deef on Mar 23, '08 07:54:42PM

Oh ok....thought I was missing something in the script.



[ Reply to This | # ]
Sequential keys
Authored by: MtnBiker on Mar 21, '08 10:45:48AM
iKeys allows sequential keys which can help remembering the keystrokes. For example, Control-s followed by say 1 types your signature, followed instead by a 2 types your address. This also gives you more keys.

Caveats: iKeys is payware; and it hasn't been updated for Leopard. In October, the company noted a change in developers and the need to update for Leopard--five months ago!

http://www.scriptsoftware.com/ikey/

---
Hermosa Beach, CA USA

[ Reply to This | # ]

Run scripts via the Script Menu via keyboard
Authored by: mark hunte on Mar 23, '08 04:07:04AM
And For those of you who do not want to move you Applescript Menu.
You can run this script with one of the Hotkey apps

It will find the menu where ever it is so long as its in the menu bar.

 tell application "System Events"
	set t to value of attribute "AXDescription" of menu bar items of menu bar 1 of application process "SystemUIServer" as list
	set menuExtraName to "AppleScript"
	repeat with i from 1 to count of items in t
		set this_item to item i of t
		if this_item is menuExtraName then
			click menu bar item i of menu bar 1 of application process "SystemUIServer"
			exit repeat
		end if
	end repeat
end tell

---
mh

[ Reply to This | # ]

Run scripts via the Script Menu via keyboard
Authored by: soundsgoodtome on Mar 23, '08 06:45:31PM

The instructions say:

"Download Add Front App to Menu.scpt. Open the script. This creates a folder for Script Editor in ~/Library » Scripts » Applications."

By "Open the script," I assume you mean to double-click it. However, when I do so, the script opens in Script Editor. Were some steps omitted?



[ Reply to This | # ]
Run scripts via the Script Menu via keyboard
Authored by: philostein on Mar 24, '08 01:53:05AM

Yes, you're right. I should have written 'open the script then run it'. The reason for opening it first is that I don't know if you can run a script straight from a Finder window (Quicksilver junkie speaking).



[ Reply to This | # ]
Run scripts via the Script Menu via keyboard
Authored by: squalene on Mar 24, '08 05:01:05PM

One of the nice things about the Scripts Menu is that once you enable it, you can choose "Open Computer Scripts Folder" and then put anything you want into that folder; Apps, Docs, scripts, aliases etc., and they'll then show up in the Scripts Menu. Selecting any of these items from the menu will open it.
The Scripts Menu thus works a lot like the old system 7 Apple menu.

I find it handy for running things that, for whatever reason, are kept in odd places on the disk, or are just annoying to navigate to.
The "User" script folder works in about the same way.



[ Reply to This | # ]
Run scripts via the Script Menu via keyboard
Authored by: philostein on Jan 09, '12 04:01:39AM
Hi, I wrote this hint. It still works in Lion, with a couple of differences:

The AppleScript Utility preferences are now in AppleScript Editor.

Subsequently, I used killall SystemUIServer in Terminal to get application scripts to show in the scripts menu. (Logging out and in is probably a safer option.)

The Add Front App to Menu.scpt link is broken, here's an alternative link: Add Front App to Menu.scpt


Cheers.

[ Reply to This | # ]