Skip to content

Instantly share code, notes, and snippets.

@JezDriver
Created February 29, 2024 23:05
Show Gist options
  • Select an option

  • Save JezDriver/8ac308c60769056868537519e5d98956 to your computer and use it in GitHub Desktop.

Select an option

Save JezDriver/8ac308c60769056868537519e5d98956 to your computer and use it in GitHub Desktop.
Applescript to type the current date in ISO format (YYYY-MM-DD)
on run {input, parameters}
set {year:y, month:m, day:d} to (current date)
# pad the day and month if single digit
set day_str to text -1 thru -2 of ("00" & d)
set mon_str to text -1 thru -2 of ("00" & (m * 1))
# make ISO8601 date string without time
set thedate to (y & "-" & mon_str & "-" & day_str) as string
tell application "System Events"
keystroke thedate
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment