Skip to content

Instantly share code, notes, and snippets.

@rubenvarela
Created August 25, 2023 05:31
Show Gist options
  • Save rubenvarela/9a828acaa1ab88d70802d2b0ab9a3a4d to your computer and use it in GitHub Desktop.
Save rubenvarela/9a828acaa1ab88d70802d2b0ab9a3a4d to your computer and use it in GitHub Desktop.
apple script to bring iterm to the front and hit enter -- (keep ssh connection active for example)
set i to 0
repeat while i < 15
-- set i to i + 1
-- https://eastmanreference.com/complete-list-of-applescript-key-codes
-- https://apple.stackexchange.com/questions/63897/can-a-mac-be-programmed-to-simulate-pressing-a-key-at-a-certain-rate-via-softwar
delay 20
tell application "iTerm" to activate
delay 1
tell application "System Events"
key code 36 -- Send Return key press
end tell
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment