Guest User

Untitled

a guest
Dec 15th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. on run argv
  2. tell application "iTerm2"
  3. set testProfile to false
  4. if (count of windows) is 1 then
  5. tell current window
  6. repeat with aTab in tabs
  7. set profileName to profile name of current session of aTab
  8. if profileName is "Test" then
  9. set testProfile to true
  10. select aTab
  11. tell current session of aTab
  12. write text (item 1 of argv)
  13. end tell
  14. exit repeat
  15. end if
  16. end repeat
  17. if not testProfile then
  18. create tab with profile "Test"
  19. activate
  20. tell current session
  21. write text (item 1 of argv)
  22. end tell
  23. end if
  24. end tell
  25. else
  26. repeat with aWindow in windows
  27. set profileName to profile name of current session of aWindow
  28. if profileName is "Test" then
  29. set testProfile to true
  30. select aWindow
  31. tell current session of current window
  32. write text (item 1 of argv)
  33. end tell
  34. exit repeat
  35. end if
  36. end repeat
  37. if not testProfile then
  38. create window with profile "Test"
  39. tell current session of current window
  40. write text (item 1 of argv)
  41. end tell
  42. end if
  43. end if
  44. end tell
  45. delay 0.02
  46. end run
Add Comment
Please, Sign In to add comment