Script to open textedit every day with the filename being that day's date?

Solution 1:

You should be able to do this in three parts:

First, create a calendar event that is set to your daily time and give it a unique name. While testing, maybe set the time of the event to some time around 'now' or a few minutes into the future.

Second, create an applescript with something like the following:

set curDate to date string of (current date)
tell application "TextEdit"
    make new document with properties {name:curDate}
end tell

Third, create an Automator 'calendar alarm' with two actions:

  • Find Calendar Events (filtre on 'title' and 'date occurred')
  • Run Applescript (insert the above script in here)

Try running the automator doc. It should create a new TextEdit document with a name like 'Thursday, June 17, 2021' that has yet to be saved. You can add in lines to the applescript part to bring TextEdit to the front or save the document, or whatever.

Automator-only: You could actually use automator exclusively to accomplish this.

  • Find Calendar Events (filtre on 'title' and 'date occurred')
  • New Text File (change settings as desired)
  • Rename Finder Items (Set to 'name single item', 'basename only', and include the Today's date variable in the 'to' field)

Save and run the automator doc.

You may have to allow access to your calendar. I should add that I'm running Sierra so there may be some differences depending upon your OS version.