Message: /usr/local/lib/ruby/gems/1.8/gems/rb-appscript-0.4.0/lib/_appscript/terminology.rb:355:in `aetes_for_app': Can't get terminology for application (AEM::Application.by_path("/Applications/Utilities/FastScripts Lite.app")): CommandError (RuntimeError)
OSERROR: -609
MESSAGE: Connection is invalid. from /usr/local/lib/ruby/gems/1.8/gems/rb-appscript-0.4.0/lib/_appscript/terminology.rb:366:in `tables_for_app'
Did this error appear after a minute's delay? If so, it's actually a timeout error [1], which would indicate a deadlock between the application, which is waiting for the script to finish before it handles the next event, and the script, which needs the application to respond to the events it's sending before it can finish. Your options are:
1. Have your menu-triggered script start a new process that does all the actual work, allowing the menu script to return straight-away so that FastScripts can handle subsequent events.
2. Use an OSA language component which can send events internally via the OSA API (I assume FastScript supports AppleScript/OSA-based menu scripts, yes?), thereby bypassing the host's event loop and thus avoiding a deadlock.
Unfortunately there isn't a full-featured OSA component available for Ruby yet (writing one is on my TODO list once I finish my Python component [2], but it'll be a while yet), so #2 is a bit of a non-starter and you'll have to go with #1 for now.
You might also contact the FastScripts author describing the deadlocking problem and see if they're willing to provide a solution at their end (feel free to point them in my direction if they need to discuss further; I've been through this with a couple other developers already and can probably dig up the relevant messages for reference).
HTH
has
[1] For some reason appscript currently gets the wrong error code back from the Apple Event Manager when timeouts happen; they should raise error -1712, not -609. For now, assume error -609 can mean either a timeout has occurred or the application has quit.
[2] See PyOSA <<a rel="nofollow" target="_blank" href="http://appscript.sourceforge.net/pyosa.html">http://appscript.sourceforge.net/pyosa.html>. It's a developer release so the usual caveats apply, but it's mostly usable with care - see its documentation for details.
It looks like you're new here. If you want to get involved, click one of these buttons!