Skip to content

Instantly share code, notes, and snippets.

@erik-megarad
Created June 2, 2020 21:02
Show Gist options
  • Save erik-megarad/e5a2c343d825049ad3cd43b8bfd9fa3c to your computer and use it in GitHub Desktop.
Save erik-megarad/e5a2c343d825049ad3cd43b8bfd9fa3c to your computer and use it in GitHub Desktop.
Applescript to type from clipboard
on numberAsKeycode(theString)
tell application "System Events"
repeat with currentChar in (every character of theString)
set cID to id of currentChar
if ((cID ≥ 48) and (cID ≤ 57)) then
key code {item (cID - 47) of {29, 18, 19, 20, 21, 23, 22, 26, 28, 25}}
else
keystroke currentChar
end if
delay 0.03
end repeat
end tell
end numberAsKeycode
set texttowrite to the clipboard
numberAsKeycode(texttowrite)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment