I'm trying to assign a global keyboard shortcut that will launch a new window of iTerm, with a specific profile. (I managed to do this to launch a new Chrome window with Automator and AppleScript, but this is proving more difficult)
This would be equivalent to activating iTerm, and in the top menu select Profiles -> "my profile", with "alt" or "option" pressed, so it'll open in a new window, not a new tab in the current window.
Any ideas how to do this with either Automator or AppleScript?
In case it's relevant, I have Mac OS Mountain Lion
(Sorry if this is an absolute noob question, I just moved from Windows to Mac, and I'm trying to optimize the things I do all the time)
Thank you!
Best Answer
The previous answer no longer works on the latest version of iTerm2 (3), since
terminal
has been discontinued. The new approach is to usecreate window with profile
.However, this doesn't work as expected: while if iTerm is running, it will open the new window using the appropriate profile. But if iTerm is not running, it will open a window using the default profile, and then it will open the second window with the supplied other profile. I came up with the following script to address this:
Of course, it would have been really easy if iTerm supported command line parameters. Hopefully it will at some point.