Re: Problem saving a new file
Re: Problem saving a new file
- Subject: Re: Problem saving a new file
- From: Axel Luttgens <email@hidden>
- Date: Tue, 23 Oct 2012 14:38:39 +0100
Le 23 oct. 2012 à 08:18, Christopher Stone <email@hidden> a écrit :
> On Oct 22, 2012, at 17:52, Axel Luttgens <email@hidden> wrote:
>>
>> tell application "TextEdit"
>> tell (make new document with properties {path:"/Users/ericrobertson/Documents/New Notes.rtf"})
>> set its text to "This is sample text"
>> save
>> end tell
>> end tell
>> --> An error pops in TextEdit: Document « New Notes.rtf » could not be saved. You aren't allowed.
>>
>> This indeed suggests that sandboxing is at work, but also that TextEdit probably isn't supposed to work that way.
> ______________________________________________________________________
>
> Hey Axel,
>
> This works perfectly well in TextEdit 1.6 (not sandboxed) but fails in 1.7.1 and 1.8.
>
> tell application "TextEdit"
> tell (make new document with properties {path:"/Users/chris/Documents/New Notes.rtf", text:"This is sample text"})
> save
> end tell
> end tell
>
> So it used to work that way but no longer does.
Hello Chris,
In fact, it still works that way, provided one does not try to create files at arbitrary locations.
For example:
tell application "TextEdit"
tell (make new document with properties {path:"New Notes.rtf"})
set its text to "This is sample text"
save
path
--> "/Users/chris/Library/Containers/com.apple.TextEdit/Data/New Notes.rtf"
end tell
end tell
If one wants to have the document created outside of the application's container, one must provide the path through a "save in..." or a "close saving in..." command which, I guess, is handled as the moral equivalent of having the user providing a path through a dialog box raised by TextEdit.
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden