You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

AppleScript (TextEdit) Error saving TextEdit document from Script Editor

I have created an AppleScript in hopes of it, when run, reporting the latest date, then saving it to a document named "LastUpdate.txt". When this script is run, it reports back with the error below.

At this point, I don't know what to do, and if possible, would like some help. Thank you in advance.

I will provide the script content below.


tell application "TextEdit"
	activate
	make new document
	set theDate to current date
	set text of document 1 to theDate as text
	save document 1 in "LastUpdate.txt"
end tell


MacBook Air

Posted on Dec 8, 2020 7:26 AM

Reply
Question marked as Top-ranking reply

Posted on Dec 8, 2020 8:29 AM

Run the following:


set theFile to open for access file (((path to desktop) as string) & "LastUpdate.txt") with write permission

write ((current date) as text) to theFile as string

close access theFile


(187729)

Similar questions

4 replies

AppleScript (TextEdit) Error saving TextEdit document from Script Editor

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.