Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I need to run an AppleScript using a keyboard shortcut. How can I do that?

I think about

  1. Save AppleScript in textual format.
  2. Use Keyboard Maestro to launch 'osascript' to run the script when the matching keyboard shortcut is called.

What do you think? Is there better way to go?

share|improve this question
add comment

2 Answers

up vote 4 down vote accepted

A program like Keyboard Maestro can do exactly as you said, but instead of saving the AppleScript as just regular text you can save it as a script (.scpt) and just pass the path to osascript.

A program that I've used off and on that is designed to do this specifically is Red Sweater Software's FastScripts. It's free for up to 10 keyboard shortcuts. Otherwise I've just used LaunchBar (while others would recommend other app launchers)

share|improve this answer
    
+1 for FastScripts, i use it daily to save HTML pages to PDFs in a predefined folder. –  systempuntoout Sep 8 '10 at 21:00
    
FastScript seems good. BTW, can it run python/ruby scripts also? –  prosseek Sep 8 '10 at 21:37
    
@prosseek: Yes. –  Chealion Sep 8 '10 at 21:43
add comment

I do it with Quicksilver to launch a script that opens a Terminal window at the same place the foremost Finder window is.

Triggers -> [+] -> HotKey, then select your script, and choose the "Execute" action.

It's probably similar to using Keyboard Maestro, and said software might be simpler. Though, I already had Quicksilver installed when I did this, so reusing it was better.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.