Open a Numbers spreadsheet with AppleScript
Hi all,
How do I get around violating the sandbox rules (sounds like a playground problem, no?) on this simple script? I'm trying to automate export from a spreadsheet that is updated arbitrarily and needs a scheduled export periodically...
I'm on
MBP 13", 3GHz, 16GB RAM, 1TB SSD
OS X: 10.12.2
Numbers: 4.0.5
This script:
tell application "Numbers" activate open "/Users/latcarf/Desktop/Test.numbers" end tell
Results in this super descriptive and indicative error alert: "Test" can't be opened for some reason.
Which is actually listed in Console as a Sandbox Violation.
SandboxViolation: Numbers(2398) deny file-read-xattr /Users/latcarf/Desktop/Test.numbers Violation: deny file-read-xattr /Users/latcarf/Desktop/Test.numbers Process: Numbers [2398] Path: /Applications/Numbers.app/Contents/MacOS/Numbers Load Address: 0x1056cb000 Identifier: com.apple.iWork.Numbers Version: 4052 (4.0.5) Code Type: x86_64 (Native) Parent Process: launchd [1] Responsible: /Applications/Numbers.app/Contents/MacOS/Numbers [2398] User ID: 501 Date/Time: 2016-12-30 12:09:14.144 EST OS Version: Mac OS X 10.12.2 (16C67) Report Version: 8
This happens regardless if Numbers is open or not open already. If the file "/Users/latcarf/Desktop/Test.numbers" (which exists) is already open, the above script will work (though it doesn't matter that it works - because the file's already open). I can't count on this file having been open already.
I think, export will fail as well with permissions errors anyway (from a sandbox violation) so this might be a non-starter.
Any way around it? Sandboxing kills automation in many, many ways...
Thanks in advance!
null-OTHER, macOS Sierra (10.12.2), Original Mac 128k hard-soldered to 512k! wOOt!