Automator AppleScript not working
I have the following AppleScript commands in an Automator workflow that I then saved as a Service:
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)) & " - "
end tell
In High Sierra this used to allow me to insert the current date in a standardized format anywhere in the OS, e.g. in notes, while editing a filename, etc. It no longer works in Mojave or later. Is there a change that needs to be made when invoking the System Events application?
MacBook Air 13″, macOS 10.14