Re: Adding playlists to iTunes with SB
Re: Adding playlists to iTunes with SB
- Subject: Re: Adding playlists to iTunes with SB
- From: has <email@hidden>
- Date: Sat, 24 Nov 2007 15:03:18 +0000
Eddy Hatcher wrote:
I am trying to create a playlist and add it to iTunes using scriptig
bridge. Based on Apples documentation I do the following:
NSDictionary *propes = [NSDictionary
dictionaryWithObjectsAndKeys:@"ZZZ", @"name", vis, @"visible", nil];
iTunesPlaylist *myPlaylist = [[[iTunes
classForScriptingClass:@"playlist"] alloc] initWithDictionary:propes];
s/initWithDictionary:/initWithProperties:/
[myUserPlaylists addObject:myPlaylist];
Be aware that -[SBElementArray addObject:] is borked on iTunes and
various other applications; see the following thread for details:
http://lists.apple.com/archives/Applescript-implementors/2007/Nov/threads.html#00034
One possible workaround is to use -insertObject:atIndex:, but that
only works if there's already one or more elements present. Another
possibility is to forgo SB's weird object creation process and
construct your own 'make' command using -[SBObject
sendEvent:id:parameters:].
Another option would be to use objc-appscript:
http://appscript.sourceforge.net/objc-appscript.html
which speaks Apple events the same way that AppleScript and the Apple
Event Manager do, allowing you to compose a 'make' command with the
correct parameters without having to resort to raw AE codes and stuff.
While objc-appscript isn't entirely finished (working on it), it's
already more functional and provides better application compatibility
than Scripting Bridge.
HTH
has
--
http://appscript.sourceforge.net
http://rb-appscript.rubyforge.org
_______________________________________________
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