I have the following AppleScript in a service using Run AppleScript in Automator:
on run {input, parameters}
set date_ to short date string of (current date)
tell application "System Events"
keystroke date_
end tell
end run
It is set to receive no input in any application, and the output replaces text. If I put the cursor in the editing window in Automator and click the run button, it works, and I get the output, e.g.:
...
end run8/15/18
I bound this to a keyboard shortcut (System Properties -> Keyboard -> Shortcuts -> select my script and bind a key combination). However, when I press the key combination, regardless of the application, I briefly (1-2 seconds) get a little spinning gear in the menu bar, and the following error in the console:
Detected missing constraints for < private>. It cannot be placed because there are not enough constraints to fully define the size and origin. Add the missing constraints, or set translatesAutoresizingMaskIntoConstraints=YES and constraints will be generated for you. If this view is laid out manually on macOS 10.12 and later, you may choose to not call [super layout] from your override. Set a breakpoint on DETECTED_MISSING_CONSTRAINTS to debug. This error will only be logged once.
The date is not added to any application where I do this. I've seen one other person with a similar issue here (https://www.alfredforum.com/topic/10311-applescripts-no-longer-work-script-editor-hangs-not-responding-on-sierra/) but they didn't get an answer either. This is confusing, as it appears to be related to window rendering, but I have no GUI elements in my script, AFAIK.
I'm running:
Mac OS Sierra 10.12.6 (16G1510)
Automator Version 2.7 (428)
Ok, while researching for this post I found this post(https://superuser.com/questions/153890/assign-a-shortcut-to-running-a-script-in-os-x/264943) that claims that there is a bug that prevents system services from running after Snow Leopard. Anyone know a workaround without third party tools?