Skip to content

Instantly share code, notes, and snippets.

@BrambleXu
Created January 7, 2021 12:24
Show Gist options
  • Save BrambleXu/be9dc606a1a99b0ade9705f1de5b6444 to your computer and use it in GitHub Desktop.
Save BrambleXu/be9dc606a1a99b0ade9705f1de5b6444 to your computer and use it in GitHub Desktop.
Shortcut to add time in mac
@BrambleXu
Copy link
Author

BrambleXu commented Jan 7, 2021

1 Quick Action:

image

2 Run AppleScript

image

3 Setup

image

tell application "System Events"
	set _date to (current date)
	keystroke ¬
		(year of _date as text) & "-" & ¬
		text -2 thru -1 of ("00" & ((month of _date) as integer)) & "-" & ¬
		text -2 thru -1 of ("00" & ((day of _date) as integer)) & " " & ¬
		text -2 thru -1 of ("00" & ((hours of _date) as integer)) & ":" & ¬
		text -2 thru -1 of ("00" & ((minutes of _date) as integer)) & ":" & ¬
		text -2 thru -1 of ("00" & ((seconds of _date) as integer))
end tell

4 Save it with a name (no space, use unserscore)

image

5 Keyboard -> Service -> Input shortcut

image

6 Security -> Allow System Event

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment