Reputation: 5436
Can someone please tell me why this won't work?
NSAppleScript* playPause = [[NSAppleScript alloc] initWithSource:
@"\
tell application \"System Events\"\n\
tell application \"Final Cut Pro\" to activate\n\
keystroke \" \"\
end tell"];
I get the error "Expected ':' ',' ';' '}' or 'attribute' before '=' token". WTF?
Thanks for your help!
Upvotes: 2
Views: 1723
Reputation: 34185
Putting a backslash before the newline inside a string literal does not work in C, Objective-C, or C++.
Just use
NSAppleScript* playPause = [[NSAppleScript alloc] initWithSource:
@"tell application \"System Events\"\n"
@" tell application \"Final Cut Pro\" to activate\n"
@" keystroke \" \""
@"end tell"];
using automatic concatenation of string literals.
Upvotes: 7