Skip to content

Instantly share code, notes, and snippets.

@chetbox
Created June 9, 2015 00:15
Show Gist options
  • Save chetbox/1ae7686c9ca58f54c5b6 to your computer and use it in GitHub Desktop.
Save chetbox/1ae7686c9ca58f54c5b6 to your computer and use it in GitHub Desktop.
# Emulate a user in a terminal for the purposes of a video recording
# Waits 1 second for every blank line
tell application "Terminal"
activate
end tell
delay 1
tell application "System Events"
set scriptContents to (read POSIX file "/Users/chetan/Desktop/terminal-script.txt" using delimiter linefeed as «class utf8»)
repeat with scriptLine in scriptContents
if length of scriptLine is greater than 0 then
log scriptLine
repeat with scriptChar in characters of scriptLine
keystroke scriptChar
delay 0.06
end repeat
delay 0.25
keystroke return
delay 0.1
else
delay 1
end if
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment