Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- on run argv
- tell application "iTerm2"
- set testProfile to false
- if (count of windows) is 1 then
- tell current window
- repeat with aTab in tabs
- set profileName to profile name of current session of aTab
- if profileName is "Test" then
- set testProfile to true
- select aTab
- tell current session of aTab
- write text (item 1 of argv)
- end tell
- exit repeat
- end if
- end repeat
- if not testProfile then
- create tab with profile "Test"
- activate
- tell current session
- write text (item 1 of argv)
- end tell
- end if
- end tell
- else
- repeat with aWindow in windows
- set profileName to profile name of current session of aWindow
- if profileName is "Test" then
- set testProfile to true
- select aWindow
- tell current session of current window
- write text (item 1 of argv)
- end tell
- exit repeat
- end if
- end repeat
- if not testProfile then
- create window with profile "Test"
- tell current session of current window
- write text (item 1 of argv)
- end tell
- end if
- end if
- end tell
- delay 0.02
- end run
Add Comment
Please, Sign In to add comment