Hi,
I'm trying to add a file to a new playlist with nsapplescript but am experiencing problem with file path containing unicode.
Any suggestion will be appreciated =)
NSString *playlist = [playlistName stringValue]; NSURL *songURL = [NSURL URLWithString:[[song track] URL]]; NSString *command = [NSString stringWithFormat: @"tell application \"iTunes\"\n\ set new_playlist to make new user playlist\n\ set name of new_playlist to \"%@\" as string\n\ add {posix file \"%@\"} to new_playlist\n\ end tell ",playlist,[songURL path]];
NSAppleScript *script = [[NSAppleScript alloc] initWithSource:command]; NSDictionary *error; [script executeAndReturnError: &error]; [script release];
Here's the error code: <NSCFDictionary 0x551cf90>{ NSAppleScriptErrorNumber = -1700; NSAppleScriptErrorMessage = iTunes got an error: Can't make some data into the expected type.; NSAppleScriptErrorRange = <00000076 00000087 >; NSAppleScriptErrorBriefMessage = Can't make some data into the expected type.; } |