How do I get the window id and tab number of a Terminal window using AppleScript via the ScriptingBr
- by Gavin Brock
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?