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



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:
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.