AppleScript runs in Automator, but fails when launched via a shortcut
I was able to get it to work by saving the AppleScript as a separate application, then creating an Automator Service that simply launches that app. Here are the steps:


Create a new AppleScript in Script Editor and paste in the following code (yours, but with a slight addition):

on run
    set date_ to short date string of (current date)
    tell application "System Events"
        set visible of (first process where it is frontmost) to false -- return focus to initiating app
        delay 0.1 -- make sure the application has had time to regain focus—if the script doesn't work, try upping this value a little
        keystroke date_
    end tell
end run

Save the script as an Application.
Create a new Service in Automator and add a Launch Application action. Set the application to the one you just saved from Script Editor.
Link a keyboard shortcut to that Automator action.


I can't verify that it works on Sierra, but it's working on High Sierra 10.13.6.