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


Click here to return to the 'A 'Save Tabs as Bookmark Folder' script for Safari' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A 'Save Tabs as Bookmark Folder' script for Safari
Authored by: Frederico on Sep 23, '04 12:09:39AM
OK, here's a couple more fixes:


on addUrlToList()
	-- add the URL to the end of the list
	tell application "Safari"
		activate
		set newURL to the URL of document 1
		--set the end of the URL_list to the URL of document 1
		if URL_list does not contain newURL then set the end of the URL_list to newURL
	end tell
end addUrlToList

The above section will prevent multiple URLs from being added; still need to fix the script so it doesn't check every URL an extra time for every open non-browser window.


-- create a new bookmark folder
tell application "Safari"
	activate
	tell application "System Events"
		tell process "Safari"
			-- add bookmark folder
			click menu item AddBookmarkFolder of menu Bookmarks of menu bar 1
			-- name the folder "Saved Tabs - <current date>"
			set theDate to (current date) as string
			keystroke "Saved Tabs - " & theDate
			-- hit return to name the folder
			keystroke return
			-- programming a tab will not select the bookmarks area, so have to
			-- create a new subfolder
			-- and then delete it
			delay 5
			try
				click button "New Bookmark" of group 2 of splitter group 1 of scroll area 1 of group 2 of window "Bookmarks"
			on error
				try
					click button "New Bookmark" of group 2 of splitter group 1 of scroll area 1 of group 1 of window "Bookmarks"
				on error
					click button "New Bookmark" of group 2 of splitter group 1 of scroll area 1 of group 3 of window "Bookmarks"
				end try
			end try
			keystroke return
			keystroke "x" using {command down}
		end tell
	end tell
end tell

This second version of the above section should create the bookmark focus required in nearly every possible window configuration (View Location Bar on/off; view Address Bar on/off; etc.)

I still have to fix the condition where the script won't run at all if the view is not that the author tested it under.

[ Reply to This | # ]