iTerm2 and Applescript - opening in a new window

677 views
Skip to first unread message

JagPanzer

unread,
Sep 17, 2010, 2:45:34 PM9/17/10
to iterm2-discuss
Is it possible via Applescript to tell iTerm2 to open a new window and
load a bookmark? Everything I seem to do has it opening in a tab of
an existing terminal.

My goal was to create a way to create some shortcuts that allow iTerm
to open a bookmark in a new window without any need for me to go into
the bookmarks menu and select what I want and choose the 'New Window'
option. I want a quick way to have these shortcut/applescript files
in a directory and then be able to call/click on them to open the
appropriate bookmark in a brand new, independent window.

I've noticed some references to being able to open either a new tab or
a new window, but I cannot seem to make it work. Any thoughts?

Mihai Moldovan

unread,
Sep 17, 2010, 4:04:26 PM9/17/10
to iterm2-...@googlegroups.com
* On 17.09.2010 08:45 PM, JagPanzer wrote:
> Is it possible via Applescript to tell iTerm2 to open a new window and
> load a bookmark? Everything I seem to do has it opening in a tab of
> an existing terminal.

tell application "iTerm"
activate

-- Create a new terminal window...
set myterm to (make new terminal)

-- ... and go on within this one.
tell myterm

-- Launch new session/Bookmark.
launch session "YOUR BOOKMARK NAME"

end tell
end tell

JagPanzer

unread,
Sep 17, 2010, 4:33:31 PM9/17/10
to iterm2-discuss
Well I swear I tried every combination of things, but I'm guessing I
didn't. Thanks - I was able to create some test scripts that opened a
new window correctly.
>  smime.p7s
> 8KViewDownload

Andrew

unread,
Oct 6, 2010, 12:54:55 PM10/6/10
to iterm2-discuss
Seems like the sdef is broken? I ran through the suite in
scriptdebugger and it threw some errors here. Not too sure how to
debug on the iterm/src end, though

George Nachman

unread,
Oct 6, 2010, 1:36:31 PM10/6/10
to iterm2-...@googlegroups.com
The last time I tried it this script worked: http://code.google.com/p/iterm2/wiki/AppleScript
If you have one that doesn't, please file a bug and include the code that you think should work.
Reply all
Reply to author
Forward
0 new messages