After using Applescript to add a new row with data to a Numbers document, I'm trying to save and close the document and then quit Numbers. Using the script below to save, close and quit Numbers works when I run it in an open Script editor window:
save document 1 in "/Users/name/Desktop/Workout.numbers"
close document 1 in "/Users/name/Desktop/Workout.numbers"
activate application "Numbers"
tell application "System Events" to keystroke "q" using command down
end
But it does not work when run as a standalone Applescript App; it seems to stop on saving.
And, as a side note, using the tell block below to quit Numbers acts in the same way; it works when run via the Script Editor, but not in an App:
tell application "Numbers"
quit
end tell
Why the difference between running in an open Script Editor window and running as an Applescipt App? How can I script Numbers to save close and quit in an Applescript App?
Best Answer
You need to direct the
save
command to Numbers app...This should work for you.
Or if you want to make the code a little prettier... This should work also.