Re: iTunes, NSAppleScript, and timeout
Re: iTunes, NSAppleScript, and timeout
- Subject: Re: iTunes, NSAppleScript, and timeout
- From: patrick machielse <email@hidden>
- Date: Thu, 22 Mar 2007 20:46:48 +0100
Op 22-mrt-2007, om 20:00 heeft has het volgende geschreven:
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.
Aha, that sounds very plausable.
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
I will be modifying the source in my application, so this isn't an
option for me.
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).
I had come across objc-appscript before, but ended up using the
eyetunes framework, since it is designed for iTunes. Then I needed to
add playlists and I was back with AppleScript...
The problem with AppleScript timeouts is that AppleScripts must be
run on the main thread, so short of spinning off a new process, the
user will be looking at the spinning beach ball for 2 minutes. In
practice this problem will be very rare, so it's not a big issue (and
eventually the script will time out), but it is something to keep in
mind for the future.
Thanks,
patrick
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden