MACSCRPT Archives

March 2014

MACSCRPT@LISTSERV.DARTMOUTH.EDU

Options: Use Monospaced Font
Show Text Part by Default
Show All Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Subject:
From:
Shane Stanley <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Fri, 14 Mar 2014 09:53:20 +1100
Content-Type:
text/plain
Parts/Attachments:
text/plain (22 lines)
On 14 Mar 2014, at 12:55 am, Bill Steele <[log in to unmask]> wrote:

> tell app “Preview”
> 	open “/user/desktop/temp.jpg”
> end tell
> —> Error: "The file couldn’t be opened because you do not have permission to view it.”
> 
> Hey, I saved it to MY desktop with MY script.
> 
> Permissions say I own it and everybody read only.  And if I open Preview and select it, it opens. 
> 
> Any ideas?

You don't mention what OS you're running, but I'd guess it's 10.8 or 10.9. Preview is now sandboxed. Sandboxed apps must be passed a file object, not a path. From the AppleScript release notes for 10.8:

> When sending commands to a sandboxed application, such as TextEdit in OS X Mountain Lion, parameters that refer to files must be of an explicit file-like type and not a bare string, or the target application will not be able to access the file. For example, file "Macintosh HD:Users:me:sample.txt", POSIX file "/Users/me/sample.txt", or the result of choose file would all be acceptable, but the string "/Users/me/sample.txt" would not.


-- 
Shane Stanley <[log in to unmask]>
<www.macosxautomation.com/applescript/apps/>

ATOM RSS1 RSS2