I, like others, have always wanted to save the open tabs in Safari as a set of bookmarked sites. One reason is when I have no choice but to quit Safari, but have not finished with all the pages in the tabs and so lose them. Looking around, I came across this hint to do just that. However, it did not work me for a couple of reasons, one being how the script has to get to the Bookmarks' scroll area to paste the urls. To overcome this problem, I discovered that if you hit the Back and Forward buttons, the scroll area is always selected. So I used this trick to get there. The other problem was the way the tabs where counted and checked for repeats and then listed -- the original script did not do any of this as well as I would have liked.
So I rewrote the script to simplify it, as well as address these issues. The script uses GUI scripting, so make sure you have that activated (it's the 'Allow access for assistive devices' checkbox in the Universal Access System Preferences panel). As usaual, I will use Spark to run mine, but you can also put the complied script in your Safari AppleScript menu, or use another launching method of choice.
[robg adds: I tested this via a Butler AppleScript action and hotkey. At first, it didn't seem to work quite right, as I wasn't getting anything bookmarked and the bookmark folder's name was incorrect. I did a bit of testing, and got it to work by adding a delay 1 line, immediately below the set theDate to (current date) as string line in the script. I was also losing the initial "S" in the keystroke "Saved Tabs line, so I simply doubled it (SSaved Tabs).
Note that these issues are quirks of my method of implementation via Butler, as I had no such issues running the raw script directly from Script Editor. As such, I haven't put my changes into the source. Once I made my tweaks, everything worked great -- I can now save open tabs by hitting Command-Option-S in Safari.]
Mac OS X Hints
http://hints.macworld.com/article.php?story=20051121170745971