Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Saving and restoring tabs in Safari' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Saving and restoring tabs in Safari
Authored by: ccstone on Dec 02, '10 08:19:19PM

{Mac OS 10.6.5, Safari 5.0.3}

Not sure if there's any point in adding to this thread at this late date, but I found it while researching something else.

In Safari 5 of course you can save all tabs in the front window at once, however since I often have 5 to 10 windows open with as many as 200 total tabs open I'd rather script it directly if I just want a temporary backup. (UI scripting is cumbersome.)

tell application "Safari"
try
set urlList to URL of tab of every window where its document is not missing value
on error errMsg number errNum
beep
tell me to display dialog "Error: " & errMsg & return & "Error Number: " & errNum
end try
end tell

This script produces a list with sublists of tabs for every document window.

It's easy to write that list to a file as data, so there's no need to convert it to text. You can then read the list as data and simply iterate through it to restore windows and tabs.

If anyone cares I'll post complete scripts.

-ccs



[ Reply to This | # ]