How about something like this?
(see this post)Code:
#Persistent
SetTimer, RecordURL, 1000
Return
RecordURL:
If WinActive( "ahk_class MozillaUIWindowClass" ) {
url := FireFoxURL()
FileRead, text, FFHistory.txt
RegExMatch( text, ".*$", match )
If ( url <> match )
FileAppend, % "`n" url, FFHistory.txt
}
Return
FireFoxURL() {
SessionStorePath := A_AppData "\Mozilla\Firefox\Profile\profile name\sessionstore.js"
WinGetTitle, WinTitle, ahk_class MozillaUIWindowClass
StringReplace, WinTitle, WinTitle, % " - Mozilla Firefox"
needle = "url":"([^"]*?)","title":"%WinTitle%
FileRead, data, %SessionStorePath%
RegExMatch(data,needle,match)
Return, match1
}