Good evening,
I would like to use an AppleScript. This AppleScript contains names with quotation marks (""). But to use them in AppleScript I have to use \". Now I tried to replace them by
But how shall I declare the quotation mark? My first try looked like this:
But because of the (\) Objective-C thinks I want to replace " with ". Can anyone help? My AppleScript looks like this:
iTunes doesn't play the track when the track title contains quotation marks. So they have to be replaced by (\"). Does anyone know a solution?
Thanks in advance,
Linus
EDIT: Wrong orthography
I would like to use an AppleScript. This AppleScript contains names with quotation marks (""). But to use them in AppleScript I have to use \". Now I tried to replace them by
Code:
- (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement
But how shall I declare the quotation mark? My first try looked like this:
Code:
NSString *name = [[textField stringValue] stringByReplacingOccurrencesOfString:@"\"" withString:@"\""];
But because of the (\) Objective-C thinks I want to replace " with ". Can anyone help? My AppleScript looks like this:
Code:
NSString *script = [NSString stringWithFormat:@"tell application \"iTunes\" \n play (every track of playlist 1 whose name is \"%@\") \n end tell", name];
iTunes doesn't play the track when the track title contains quotation marks. So they have to be replaced by (\"). Does anyone know a solution?
Thanks in advance,
Linus
EDIT: Wrong orthography