• 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: Play Playlist in iTunes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Play Playlist in iTunes


  • Subject: Re: Play Playlist in iTunes
  • From: has <email@hidden>
  • Date: Thu, 2 Oct 2008 23:35:21 +0100

Mr. Gecko wrote:

Ok I now read everything in the programming guide for Scripting Bridge
and it is really cool, Now I can't seem to find out how to play a
playlist from a name id or anything.


If you know how to write an application command in AppleScript, e.g.:

	tell application "iTunes" to play playlist "Top 25 Most Played"

you can use the appscript project's very handy ASTranslate tool [1] to convert it to equivalent objc-appscript syntax:

	// To create glue:  osaglue  -o ITGlue  -p IT  iTunes

	ITApplication *itunes = [ITApplication applicationWithName: @"iTunes"];

	ITReference *ref = [[itunes playlists] byName: @"Top 25 Most Played"];

	id result = [[ref play] send];

which you can clean up as needed for use in your own code.

ASTranslate doesn't do Scripting Bridge syntax, but that's because SB is mince (and inadequately documented mince at that). Obviously I'd recommend using appscript over SB as appscript's better technology in pretty much every way that counts (more powerful, more mature, significantly better application compatibility, also supports Panther and Tiger, equal or better performance, better documentation, better tool support, doesn't manage to obfuscate and confuse Apple event IPC even worse than AppleScript does). SB's only noticeable advantage is that it's installed as standard in OS X (10.5+) whereas you'll need to build and bundle appscript yourself in any products you release (a fairly trivial task, and appscript's license is very liberal). But you pays your money, etc.

HTH

has

[1] http://appscript.sourceforge.net/tools.html
--
Control AppleScriptable applications from Python, Ruby and ObjC:
http://appscript.sourceforge.net

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Re: -[NSScanner scanUpToString:stopString:NULL] - 10.3.9 Crash, due Xcode 3.1?
  • Next by Date: Re: Play Playlist in iTunes
  • Previous by thread: Re: Play Playlist in iTunes
  • Next by thread: Re: Play Playlist in iTunes
  • Index(es):
    • Date
    • Thread