How do I get the window id and tab number of a Terminal window using AppleScript via the ScriptingBr

Posted by Gavin Brock on Stack Overflow See other posts from Stack Overflow or by Gavin Brock
Published on 2010-04-26T10:26:41Z Indexed on 2010/04/26 11:13 UTC
Read the original article Hit count: 320

I can open a Terminal tab using the following AppleScript:

tell application "Terminal"
    set myTab to do script "exec sleep 1"
    get myTab
end tell

This returns a string like: tab 1 of window id 3263 of application "Terminal". This is great, I can see the window id 3263 and tab number 1 (although I don't know how to query myTab to get only these values).

In the Cocoa ScriptingBridge, I can do:

SBApplication  *terminal;
SBObject       *tab;

terminal = [SBApplication applicationWithBundleIdentifier:@"com.apple.terminal"]
tab = [terminal doScript:@"exec sleep 1" in:nil]

How do I get the window id and tab number from the tab object?

© Stack Overflow or respective owner

Related posts about applescript

Related posts about scriptingbridge