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:
Bill Steele <[log in to unmask]>
Reply To:
Macintosh Scripting Systems <[log in to unmask]>
Date:
Fri, 14 Mar 2014 19:31:44 +0000
Content-Type:
text/plain
Parts/Attachments:
text/plain (27 lines)
On Mar 13, 2014, at 6:53 PM, Shane Stanley <[log in to unmask]> wrote:

> 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.


I was using POSIX path. Worked with Preview in tests, but not after the Image events stuff.



Bill Steele
[log in to unmask]

ATOM RSS1 RSS2