I have some applescript based Automator services, for instance,
Launch Emacs With Selected File:
tell application "Finder" set selectedDirectory to (quoted form of POSIX path of (target of window 1 as alias)) set selectedItem to (quoted form of POSIX path of (the selection as alias)) tell application "Terminal" tell window 1 do script "cd " & selectedDirectory & " && emacs " & selectedItem end tell activate end tell end tell
I assigned it to a keyboard shortcut
Ctrl-E and has been using it for several months now.
But the service it quite unstable. When my machine, a MacBook Pro running OS X 10.8, is in normal load, responsive to other tasks, and Terminal is already up running, all the following could happen:
- About half of the time it's fast, taking less than a second to respond.
- About 25% of the time it takes three seconds or so to launch a new Terminal window.
- About 5% of the time it takes forever. I tend to believe that it won't respond at all, but after twenty seconds a window finally appears, which is pretty weird.
- About 10% of the time I get an error message
Workflow encountered an erroror something like that.
- About 10% of the time the shortcut doesn't respond at all (it will just highlight another file; but there is absolutely no shortcut conflict). I have to go to
Finder->Services->Launch ...to use the service.
Any idea why the service is so unstable? (Well, this is not my only unstable service; actually every service I created is quite unstable...) Thanks in advance.