tiistai 29. heinäkuuta 2014

Launch a script with a keyboard shortcut

To launch an AppleScript application with a keyboard shortcut I used to have such a clean way in Snow Leopard:



This is a screen shot from Automator, where I've started to create a Service. Keyboard shortcuts can be assigned to Services (System Preferences / Keyboard / Shortcuts / Services) which would then launch your desired application. But for some reason I began to get weird problems to launch my applications in Mavericks. Sometimes a dialog box appeared, asking me whether I'd like to "run" or "cancel" the program which I just decided to launch. So that would render useless the keyboard shortcut. Sometimes application just failed to run and an error notification would appear.

I found a solution which has kept every error or weird dialog box out from the equation in Mavericks.


Can't say it's the most clean way, but it works and I can continue using keyboard shortcuts as they should work. And yes, the 1 second pause before "Run AppleScript" is because errors occur without it.

Here's the code for copy-paste:

do shell script "open " & quoted form of POSIX path of alias ((path to home folder as text) & "Dropbox:AppleScript Applications:my superb app.app")

Ei kommentteja:

Lähetä kommentti