• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem saving a new file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Re: Problem saving a new file (From: Eric Robertson <email@hidden>)
 >Re: Problem saving a new file (From: Axel Luttgens <email@hidden>)
 >Re: Problem saving a new file (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: TID & text items issue
  • Next by Date: Re: TID & text items issue
  • Previous by thread: Re: Problem saving a new file
  • Next by thread: Re: Problem saving a new file
  • Index(es):
    • Date
    • Thread