FROM : Eddy Hatcher
DATE : Sat Nov 24 12:26:41 2007
Hi,
I am trying to create a playlist and add it to iTunes using scriptig
bridge. Based on Apples documentation I do the following:
iTunesApplication *iTunes = [SBApplication
applicationWithBundleIdentifier:@"com.apple.iTunes"];
SBElementArray *sources = [iTunes sources];
iTunesSource *librarySource = [sources objectWithName:@"Library"];
SBElementArray *myUserPlaylists = [librarySource userPlaylists];
[iTunes activate];
NSNumber *vis = [NSNumber numberWithBool:TRUE];
NSDictionary *propes = [NSDictionary
dictionaryWithObjectsAndKeys:@"ZZZ", @"name", vis, @"visible", nil];
iTunesPlaylist *myPlaylist = [[[iTunes
classForScriptingClass:@"playlist"] alloc] initWithDictionary:propes];
//NSLog(@"Custom Playlist: %@", [myPlaylist name]);
[myUserPlaylists addObject:myPlaylist];
However, the application goes into debug mode and I am having
difficulties knowing what is going wrong. Am I initializing the custom
playlist with the wrong or to few parameters? Later on I would like to
add a couple of tracks to my playlist.
Any help is highly appreciated
Ed
DATE : Sat Nov 24 12:26:41 2007
Hi,
I am trying to create a playlist and add it to iTunes using scriptig
bridge. Based on Apples documentation I do the following:
iTunesApplication *iTunes = [SBApplication
applicationWithBundleIdentifier:@"com.apple.iTunes"];
SBElementArray *sources = [iTunes sources];
iTunesSource *librarySource = [sources objectWithName:@"Library"];
SBElementArray *myUserPlaylists = [librarySource userPlaylists];
[iTunes activate];
NSNumber *vis = [NSNumber numberWithBool:TRUE];
NSDictionary *propes = [NSDictionary
dictionaryWithObjectsAndKeys:@"ZZZ", @"name", vis, @"visible", nil];
iTunesPlaylist *myPlaylist = [[[iTunes
classForScriptingClass:@"playlist"] alloc] initWithDictionary:propes];
//NSLog(@"Custom Playlist: %@", [myPlaylist name]);
[myUserPlaylists addObject:myPlaylist];
However, the application goes into debug mode and I am having
difficulties knowing what is going wrong. Am I initializing the custom
playlist with the wrong or to few parameters? Later on I would like to
add a couple of tracks to my playlist.
Any help is highly appreciated
Ed
| Related mails | Author | Date |
|---|---|---|
| Eddy Hatcher | Nov 24, 12:26 | |
| has | Nov 24, 16:03 |






Cocoa mail archive

