0

I want to be able to type at command prompt it2 myMachine and have a new session pop up with defaults for that profile in Iterm2.

The following used to work until upgrades, where $1 is the profile name...

osascript <<ENDSCRIPT
on run argv
  tell application "iTerm"
    activate
    tell the first terminal
      launch session "$1"
    end tell
  end tell
end run
ENDSCRIPT

71:79: syntax error: Expected class name but found identifier. (-2741)

I also am looking at straight osascript in bash. But new tab does not get command.

osascript -e "tell application \"Terminal\""
     -e "tell application \"System Events\" to keystroke \"t\" using {command down}" 
 -e "do script \"cd $pwd; clear\" in front window"  
 -e  "end tell"
Jacob
  • 349
  • 1
  • 2
  • 12
  • I found all on iterm2 help pages... tell application "iTerm2" tell current window create tab with default profile end tell end tell There are many standard Applescript functions (e.g., to get the window's size and position) that are not documented here. create tab with default profile create tab with profile "name" – Jacob Jul 19 '16 at 13:44

1 Answers1

0

I found all on iterm2 help pages... tell application "iTerm2" tell current window create tab with default profile end tell end tell There are many standard Applescript functions (e.g., to get the window's size and position) that are not documented here. create tab with default profile create tab with profile "name"

Jacob
  • 349
  • 1
  • 2
  • 12