Script to save all open tabs?

Now that tabs are scriptable, does anyone know how to write the above script? I’ve taken a stab at it, but mine doesn’t work:

tell application "DEVONthink Pro"
	set theTabs to the tabs of think window 1
	repeat with theTab in theTabs
		if exists URL of theTab then create record with {name:name of theTab, URL:URL of theTab, type:URL}
	end repeat
end tell

It looks as though the name property is broken in the tab class. This is a workaround:

tell application "DEVONthink Pro"
	set theWindow to the 1st document window whose visible is true
	repeat with theTab in (get tabs of theWindow)
		if theTab's URL is not "" then
			set theURL to theTab's URL
			set soss to theTab's source
			set nam to get title of the soss
			create record with {name:nam, type:bookmark, URL:theURL}
		end if
	end repeat
end tell

BTW, the tab’s url always exists, even if it’s empty, so you have to check its length.


Tabs don’t have a name property right now.