safari history

I am looking for a way to collect all the pages that are visited, even the ones while in Private Browsing mode, in a way of url, title page, with date and time in a text file (tabbed list) so even when I (or someone else) cancel History I still have a record of pages visited. This ideally would be stored in a file somewhere on Hard disc.
And is there a way to have this script work all the time, automatically, whenever a new window or tab is open? Without me choosing it every time?
Waiting for any ideas, suggestions, tips and help
Cheers
Pasqdek

Model: imac
Browser: Safari 419.3
Operating System: Mac OS X (10.4)

Hi,

some weeks ago I wrote a script to gather the informations from the History.plist file and store it in a text file.
Hope it helps

set TIMEoffset to ("2001-01-01" as «class isot» as date) + (time to GMT)
set pListpath to (path to library folder from user domain as Unicode text) & "Safari:History.plist"
tell application "System Events"
	tell property list items of property list item 1 of contents of property list file pListpath
		set theValues to value of property list items
	end tell
end tell
set theText to ""
repeat with i in theValues
	try
		set {_URL, _date, dummy, _title} to items of contents of i
		set d to ((text 1 thru -3 of _date) as number) + (((text -1 of _date) as number) / 10)
		tell (TIMEoffset + d) to set thedate to its short date string & space & its time string
		set theText to theText & (thedate & tab & _title & tab & _URL & return)
	end try
end repeat
set TimeStamp to do shell script "date -n +%Y-%m-%d"
set target to choose file name default name "SafariHistory_" & TimeStamp & ".txt"
set ff to open for access target with write permission
write theText to ff
close access ff

Interesting one !

Would it be possible to automatically run the script when quitting Safari, and always save the file into the same folder (without asking) ?

Thanks for your help.

Nice script Stefan, it’ll come in useful.

Whilst on the subject of Safari…
Because I tend to skip from one place to another I sometimes end up with loads of windows open.
I created the script below to make a list of all the open windows and save it to the clipboard.
Not sure if it’s of use to anyone.

Regards,

Nick

tell application "Safari"
	set winList to {}
	repeat with i from 1 to count of documents
		set winList to winList & name of document i & return
		set winList to winList & URL of document i & return & return
	end repeat
	set the clipboard to winList as text
end tell