Saving to desktop with TextEdit - El Capitan vs Sierra [1]
Saving to desktop with TextEdit - El Capitan vs Sierra [1]
- Subject: Saving to desktop with TextEdit - El Capitan vs Sierra [1]
- From: Axel Luttgens <email@hidden>
- Date: Sat, 24 Dec 2016 14:42:20 +0100
> Le 21 déc. 2016 à 13:47, Brian Christmas a écrit :
>
> G’day again.
>
> This definitily does not work. ‘Do not have permission. I’ve set everything I can to full permissions, but can’t work out the correct permissions to add to do shell script “mkdir
>
> I cannot work out how to open the correct MAN files.
>
> tell application "TextEdit"
> activate
> do shell script "Sleep 1"
> tell document 1
> set pathToFile to ((path to desktop as alias) & "test" & ".rtfd" as text) # yearly_Desktop_Daily_Folder
> save in pathToFile as alias
> end tell
> end tell
>
> […]
>
> Trouble is, I’ve lots of different files to save. This latest update to Sierra has really thrown aspanner in three works.
>
> Please, any thoughts
When reading above code snippet for the first time, I immediately thought that the problem was with an attempt to define an AppleScript alias for a non existing file (and thus suggested to make use of "POSIX file" instead of "as alias").
Re-thinking a bit harder (if possible), the 'as alias' part may in fact be a dont care one: save as <type> in <file>, where <type> is "alias".
In which case the problem might reside in an attempt to 'save to a string', as in following code:
tell application "TextEdit"
make new document
tell document 1
set pathToFile to ((path to desktop as text) & "test.rtfd")
save in pathToFile
end tell
quit
end tell
An indeed, trying under El Capitan (10.11.6), TextEdit obscurely complains about some lack of permissions, and Script Editor’s log shows:
tell application "TextEdit"
make new document
--> document "Sans titre 2"
path to desktop as alias
--> error number -1708
«event ascrgdut»
--> error number -1708
path to desktop as alias
--> alias "ElCapitan:Users:luttgens:Desktop:"
save document 1 in "ElCapitan:Users:luttgens:Desktop:test.rtfd"
--> error number -10000
But surprise! Trying the same code under Sierra (10.12.2), TextEdit doesn’t complain and instead successfully creates the file; Script Editor’s log shows:
tell application "TextEdit"
make new document
--> document "Sans titre 2"
path to desktop as alias
--> error number -1708
«event ascrgdut»
--> error number -1708
path to desktop as alias
--> alias "Sierra:Users:luttgens:Desktop:"
save document 1 in "Sierra:Users:luttgens:Desktop:test.rtfd"
quit
end tell
TextEdit indeed is a sandboxed application, but its container is designed so as to allow a direct access to the user’s desktop; TextEdit thus shouldn’t have problems with the creation of arbitrary files on the desktop.
So, given the above, either Brian shouldn’t have encountered any problem, or my Sierra installation is somewhat screwed.
Could someone else try?
TIA,
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