# https://apple.stackexchange.com/questions/175215/how-do-i-assign-a-keyboard-shortcut-to-an-applescript-i-wrote on run {input, parameters} tell application "System Events" key code 123 using command down keystroke "print(" key code 124 using command down keystroke ")" end tell return input end run