Add keyboard shortcuts to AppleScripts in Mail.app

Jun 21, '04 09:38:00AM

Contributed by: FunkDaddy

I have a spam-reporting AppleScript for Mail.app that I wrote and process manually, and I wanted to assign a keyboard shortcut to it like some of the scripts Apple provides in the script menu.

I looked at the scripts in the Mail.app package and saw that some had something like ___ctl-r at the end of their names. So I added ___ctl-s (that's three underscores) to the end of the Script name in my ~Library -> Scripts folder, and updated the script menu. Voila! It added a Control-S marking next to the Script in the menu. cmd and opt also work for command and option respectively.

I tried to get multiple modifier keys to work, but couldn't figure out how to do it, or if it's even possible. Using a key combination that's already used by Mail removes any key combination from that script.

[robg adds: This was mentioned in passing before, as I noted here. However, I figure this is worth documenting in its own hint. I've been able to use multiple modifiers just by combining them: script-name___ctl-cmd-p.scpt assigns Control-Command-P, for instance. As far as I know, this only works for Mail scripts, not Finder scripts nor any others that I've heard of.]

Comments (2)


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