Improve response of some AppleScripts called by Butler

Jul 10, '07 07:30:00AM

Contributed by: ptone

I have stay open AppleScript application with a number of handlers that control my Mac mini-based home theater setup. These turn on or off different components, etc. I use keyboard shortcuts through Butler (among other methods) to call these handlers with scripts like:

tell application "HTPC" to power_tv()
However, some of these routines were running slowly when called via Butler, but not when the same trigger script was run in Script Editor. I'm not sure of the details, but it has something to do with Butler's AppleScript runtime assumptions and how it waits for responses. The fix was to tell Butler not to wait for any script response:
ignoring application responses
  tell application "HTPC" to power_tv()
end ignoring
I don't think this will improve all scripts run from Butler, only those that invoke some additional AppleScript calls outside of Butler. They particularly affected scripts with exists process statements, and other System Events calls.

Comments (0)


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