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 07:26 AM

Reply
Question marked as Top-ranking reply

Posted on Dec 8, 2020 08: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

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

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.