Repository Public Research preview
1-- List the tabs of one window: index, URL and title, tab-separated, one per line.2-- Usage: osascript list-tabs.applescript <window-id>3on run argv4 set w to (item 1 of argv) as integer5 set out to ""6 -- Inside a Safari "tell" block the word "tab" means a browser tab, not the tab character:7 -- name the separator outside it.8 set sep to character id 99 tell application "Safari"10 repeat with t in tabs of window id w11 set u to URL of t12 if u is missing value then set u to ""13 set n to name of t14 if n is missing value then set n to ""15 set out to out & (index of t) & sep & u & sep & n & (character id 10)16 end repeat17 end tell18 return out19end run20