Home
Head's Up: I'm in the middle of upgrading my site. Most things are in place, but there are something missing and/or broken including image alt text. Please bear with me while I'm getting things fixed.

Get The Site Names And URLs For Open Safari Tabs With OSA AppleScript

Paste this into the Script Editor app and run it as AppleScript to get the title and URL for all your open tabs in safari.

It uses [TODO: Code shorthand span ] as a separator. Using an actual tab character might work, but your mileage may vary. (Commas are ill advised since they are a valid URL character)

tell application "Safari"
	set tabList to ""
	set numberOfWindows to count (every window where visible is true)
	repeat with windowNumber from 1 to numberOfWindows
		set numberOfTabs to number of tabs in window windowNumber
		repeat with tabNumber from 1 to numberOfTabs
			set tabName to name of tab tabNumber of window windowNumber
			set tabURL to URL of tab tabNumber of window windowNumber as string
			set tabList to tabList & tabName & "~~~" & tabURL & linefeed as string
		end repeat
	end repeat
end tell

return tabList