The words Under construction in black text on a yellow background with diagonal black stipes surrounding it
I'm in the process of moving my site. It's still a work in progress. Please excuse the mess and broken links.

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

TODO: Pull subtitle into page object code_start_default_section code_end_default_section

Debugging Stuff

I'm moving stuff around right now. All this below is helping me figure out where to put stuff

        -- title

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 `~~~` 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)

-- code/

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

-- /code

This is what I used to capture my browsing history 
each day while I was using Safari. Chrome is gonna 
take some more work.

I found the core of this script on another site, 
but I'm not sure where. If I find it, I'll update 
this with a link.


-- categories
-- AppleScript
-- OSA Script

-- metadata
-- date: 2021-08-26 11:32:41
-- id: 20eon2bg
-- status: published
-- type: post
-- site: aws