• 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
iTunes and AppleScript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

iTunes and AppleScript


  • Subject: iTunes and AppleScript
  • From: John Stiles <email@hidden>
  • Date: Thu, 24 Aug 2006 10:45:51 -0700

We've experimented with code which used NSAppleScript to communicate with iTunes, like so:

NSAppleScript* script = [[NSAppleScript alloc] initWithSource:
@"try\n"
"with timeout of 1 second\n"
" tell application \"iTunes\"\n"
" next track\n"
" if player state is playing then\n"
" get name of current track\n"
" end if\n"
" end tell\n"
"end timeout\n"];

NSDictionary * error = NULL;
NSAppleEventDescriptor* result = [script executeAndReturnError:&error];


Normally this works great and everyone is happy.
However, in some instances, iTunes will put up a dialog (imagine the next track is purchased from the Music Store and you're not logged in, for instance).
In this case, the code blocks for several minutes, despite the timeout conditions inside the script.
Is there a workaround? Could this be solved if we used the lower- level AppleEvents APIs, which theoretically would give us more fine- grained control?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden
  • Prev by Date: Re: Two windows in a nib with NSWindowController?
  • Next by Date: Re: Two windows in a nib with NSWindowController?
  • Previous by thread: [Moderator] EOT Re: Help Button - where to place it
  • Next by thread: Re: iTunes and AppleScript
  • Index(es):
    • Date
    • Thread