After upgrading to OS X 10.10 and Numbers 3.5, applescript and ASOC apps can no longer open Numbers files. Numbers returns a message stating “file name” Can’t be opened. If I run Numbers and open the file first then the apps work fine. I’ve tried recompiling but no success, what am I missing?
Model: iMac
AppleScript: 2.4
Browser: Safari 600.1.25
Operating System: Mac OS X (10.8)
Are you using paths or aliases/file objects in the open command?
Thanks for reply, I have been using the following code, worked before Yosemite.
tell application “Numbers”
activate
open “Macintosh HD:Users:Ours:Documents:Cats Protection:Membership:CP Membership List.numbers”
end tell
You can’t do that with sandboxed applications – you have to use a file object or alias. Insert the word alias before the path.
Tried with alias as suggested but returned message "-[AppDelegate applicationWillFinishLaunching:]: alias “Macintosh HD:Users:Ours:Documents:Cats Protection:Membership:CP Membership List.numbers” of «script» doesn’t understand the “open” message. (error -1708)
Help!
Try this:
set theFile to "Macintosh HD:Users:Ours:Documents:Cats Protection:Membership:CP Membership List.numbers" as alias
tell application "Numbers"
activate
open theFile
end tell
Brilliant, all working now, thanks for your patience. I’m still a bit puzzled about what has changed in Yosemite to stop my scripts working, I’d be grateful for an explanation.
It’s to do with sandboxing. As a security measure, sandboxed applications can’t access files based on paths alone – the user normally has to choose the file in a dialog, giving the application what is known as a “security scoped” reference to the file. A script has to pass a file object, which AppleScript then converts makes “security scoped”.