Skip to content

Instantly share code, notes, and snippets.

@cweave
Created March 24, 2022 03:53
Show Gist options
  • Save cweave/1d654415ef95eda3293883ee6298cfb5 to your computer and use it in GitHub Desktop.
Save cweave/1d654415ef95eda3293883ee6298cfb5 to your computer and use it in GitHub Desktop.
Automating iTerm2 with Applescript
#!/usr/bin/osascript
tell application "iTerm2"
# Open window in full screen
tell application "System Events"
keystroke "f" using {control down, command down}
end tell
set serverSession to current session of current window
tell serverSession
set name to "SERVER"
# navigate to directory and start service
write text "cdkwhub"
write text "rs"
# split vertically
set webpackSession to (split vertically with default profile)
end tell
tell webpackSession
set name to "WEBPACK"
# navigate to directory and start service
write text "cdkwhub"
write text "rw"
end tell
tell current window
create tab with default profile
set tab2 to current session
end tell
tell tab2
set name to "ENGINE"
# navigate to directory and start service
write text "runkwengine"
end tell
tell current window
create tab with default profile
set tab3 to current session
end tell
tell tab3
set name to "REPORTING"
# navigate to directory and start service
write text "cdkwreporting"
write text "npm run start"
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment