Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: iTunes, NSAppleScript, and timeout



patrick machielse wrote:

Timing out seems to work fine most of the time _except_ when iTunes' open panel is up the first time doScript: is executed. In that case I have to sit through the entire default timeout period (2 minutes).
[...]
Is this a bug

Your ObjC program is compiling AppleScript source code on the fly, so if the AppleScript component hasn't already obtained the iTunes terminology, it sends iTunes an 'ascrgdte' event to get it. That's the event that's stalling, not the 'get' command in your script.


There's no way to specify a custom timeout for the 'ascrgdte' event, so you'll need to use a different approach that doesn't require getting iTunes' terminology at runtime: either 1. load a compiled AppleScript (.scpt) file located in your bundle, or 2. ditch AppleScript and talk to iTunes directly from ObjC via the low-level Apple Event Manager API (tedious as hell for anything non-trivial) or via a high-level API such as objc-appscript [1] (see my sig).

HTH

has

[1] Not entirely finished (you'll need to ask me about specifying timeouts and other attributes), but already quite usable.
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org
http://appscript.sourceforge.net/objc-appscript.html


_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/applescript-users/email@hidden
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.