• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: iTunes, NSAppleScript, and timeout
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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
  • Follow-Ups:
    • RE: iTunes, NSAppleScript, and timeout
      • From: Olof Hellman <email@hidden>
  • Prev by Date: Re: do shell hanging
  • Next by Date: Re: do shell hanging
  • Previous by thread: Re: iTunes, NSAppleScript, and timeout
  • Next by thread: RE: iTunes, NSAppleScript, and timeout
  • Index(es):
    • Date
    • Thread