Not sure if this one is possible in objective-c without having the script as a file and running it that way.
NSAppleScript *appleScriptGetHH = [[NSAppleScript alloc] initWithSource:@\
"tell application \"System Events\"\n \
tell process \"Grabee\"\n \
with timeout of 0 seconds\n \
get value of attribute \"AXValue\" of text area 1 of scroll area 1 of window \"Demo Window 1" \n \
end timeout \n \
end tell \n \
end tell"];
This works perfectly, but what I would like to do is replace "Demo Window 1" with a string (as it will be changed dynamically in the program)
When I use something like this
NSString *windowName = @"Green Window4";
And then replace this line:
get value of attribute \"AXValue\" of text area 1 of scroll area 1 of window \"Demo Window 1" \n \
With:
get value of attribute \"AXValue\" of text area 1 of scroll area 1 of window \"%@" \n \
And
end tell", windowName];
I receive an error that there are too many arguments, is there a way to do this without having the script separate?