Re: Play Playlist in iTunes
Re: Play Playlist in iTunes
- Subject: Re: Play Playlist in iTunes
- From: "Michael Ash" <email@hidden>
- Date: Thu, 2 Oct 2008 00:09:59 -0400
On Wed, Oct 1, 2008 at 10:16 PM, Mr. Gecko <email@hidden> wrote:
> I think I would just use this AppleScript call
> [[[NSAppleScript alloc] initWithSource:[NSString stringWithFormat:@"tell
> application \"iTunes\" to play playlist \"%@\"", [self replace:@"\""
> with:@"\\\"" source:[sender title]]]] executeAndReturnError:nil];
> Works fast enough for me and it would work with " because I use my replace
> function to make it \".
You'll also want to replace \ with \\ (make sure you do this *before*
you replace " with \") and *possibly* some others as well, I'm not
completely familiar with exactly what AppleScript allows in strings.
You may also have problems with non-ASCII characters, as AppleScript
is notoriously Unicode-unsavvy.
Last time I had to do something like this (although it was
considerably more complex), I built a library to make it easy to build
raw Apple Events to mimic AppleScript without the mess that comes with
actually using AppleScript itself. If you want to check it out, you
can find more information about it here:
http://www.cocoadev.com/index.pl?AEVTBuilder
Mike
_______________________________________________
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