Skip to content

Instantly share code, notes, and snippets.

@Zettt
Created May 28, 2015 13:48
Show Gist options
  • Save Zettt/f47d963ecc1ac13c3a94 to your computer and use it in GitHub Desktop.
Save Zettt/f47d963ecc1ac13c3a94 to your computer and use it in GitHub Desktop.
This script types a long string without errors(!!!) for you. Delay between keystrokes is variable. Originally taken from http://christianheilmann.com/2014/01/09/autmating-typing-in-screencasts-with-applescript-or-how-to-look-like-a-hollywood-hacker/
set myLines to "Brainstorming is a group or individual creativity technique by which efforts are made to find a conclusion for a specific problem by gathering a list of ideas spontaneously contributed by its member(s). The term was popularized by Alex Faickney Osborn in the 1953 book Applied Imagination. Osborn claimed that brainstorming was more effective than individuals working alone in generating ideas, although more recent research has questioned this conclusion. Today, the term is used as a catch all for all group ideation sessions."
set recordedApp to "iOS Simulator"
set typingDelay to "0.1" --try 0.05 so something much faster (double, actually)
--make sure the recorded app is foreground
--otherwise it can result into missing strings
activate application recordedApp
delay 3
repeat with currentline in myLines
write_string(currentline)
end repeat
on write_string(the_string)
tell application "System Events"
activate application recordedApp
repeat with the_character in the_string
keystroke the_character
delay typingDelay
end repeat
end tell
end write_string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment