SHARE
TWEET

Untitled

a guest Mar 20th, 2017 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. --- While `keystroke text_to_write` also works, it types so fast some characters get mixed up.
  2. --- For example, `keytroke "Example"` might result in `EXample` as if AppleScript wasn’t fast enough to release ⇧ after the `E`.
  3. --- By using a `repeat` loop, we ensure each character gets typed in isolation.
  4.  
  5. set text_to_write to "{{whatever you want}}"
  6.  
  7. tell application "System Events"
  8.   repeat with c from 1 to count characters of text_to_write
  9.     keystroke (character c of text_to_write)
  10.   end repeat
  11. end tell
RAW Paste Data
Top