Tys Posted January 12, 2006 Posted January 12, 2006 This little script synchronizes the bookmarks.html file to a ftp location, enabling you to browse the same bookmarks on different computers. Put the three files in the installation directory of firefox.Requirements: a FTP-server, firefox( duh) and a working internet connectionnot done (and probably not will be doing it): proxy support, multiple firefox profileshere is the script, additionally, you need curl.exe and 7za.exe. For the less paranoid, I provided them in the archive.Here is the code:expandcollapse popup;check for running firefox if ProcessExists("firefox.exe") then Run(@ProgramFilesDir & "\Mozilla Firefox\firefox.exe", @ProgramFilesDir & "\Mozilla Firefox") Exit EndIf ;cURL download bookmarks $begin = TimerInit() $error = RunWait('curl.exe ftp://username:password@servername/bookmarks.7z -o "' & @ScriptDir & '\bookmarks.7z"', "", @SW_HIDE) If $error Then If $error <> 19 Then MsgBox(0, "Oi!", "Fehler beim Herunterladen der Bookmarks", 5) Exit EndIf EndIf ;MsgBox(0, "Oi!", "Bookmarks heruntergeladen in " & Round((TimerDiff($begin) / 1000), 1) & " Sekunden", 5) ;unpack bookmarks $begin = TimerInit() Runwait(@ScriptDir & '\7za.exe e -t7z -y "' & @ScriptDir & '\bookmarks.7z"', @ScriptDir, @SW_HIDE) ;MsgBox(0, "Oi!", "Bookmarks entpackt in " & Round((TimerDiff($begin) / 1000), 1) & " Sekunden", 5) ;Search Firefox profile path $search_tmp = FileFindFirstFile(@AppDataDir & "\Mozilla\Firefox\Profiles\*") $firefox_profile_dir = @AppDataDir & "\Mozilla\Firefox\Profiles\" & FileFindNextFile($search_tmp) FileClose($search_tmp) ;backup local_database FileCopy($firefox_profile_dir & "\bookmarks.html", $firefox_profile_dir & "\bookmarks.bak", 1) ;copy bookmarks to firefox profile dir FileCopy(@ScriptDir & "\bookmarks.html", $firefox_profile_dir & "\bookmarks.html", 1) FileDelete(@ScriptDir & "\bookmarks.html") FileDelete(@ScriptDir & "\bookmarks.7z") ;Run Firefox, get PID $firefox_PID = Run(@ProgramFilesDir & "\Mozilla Firefox\firefox.exe", @ProgramFilesDir & "\Mozilla Firefox") ProcessWaitClose($firefox_PID) ;compress bookmarks $begin = TimerInit() Runwait(@ScriptDir & '\7za.exe a -t7z -y "' & @ScriptDir & '\bookmarks.7z" "' & $firefox_profile_dir & '\bookmarks.html"', @ScriptDir, @SW_HIDE) ;MsgBox(0, "Oi!", "Bookmarks gepackt in " & Round((TimerDiff($begin) / 1000), 1) & " Sekunden", 5) ;cURL upload bookmarks $begin = TimerInit() $error = RunWait('curl.exe -T "' & @ScriptDir & '\bookmarks.7z" ' & 'ftp://username:password@servername', "", @SW_HIDE) If $error Then MsgBox(0, "Oi!", "Fehler beim Hochladen der Bookmarks", 5) Exit EndIf ;MsgBox(0, "Oi!", "Bookmarks hochgeladen in " & Round((TimerDiff($begin) / 1000), 1) & " Sekunden", 5) FileDelete(@scriptdir & "\bookmarks.7z") FileDelete(@scriptdir & "\bookmarks.html")FireBookSync.zip
masvil Posted January 12, 2006 Posted January 12, 2006 It will be for my personal use. Thanx! Just for curiosity: do you use curl instead of other ftp methods because of proxies prospective (Curl support them) ?
Tys Posted January 12, 2006 Author Posted January 12, 2006 It will be for my personal use. Thanx!Just for curiosity: do you use curl instead of other ftp methods because of proxies prospective (Curl support them) ?No, I reused parts of another, older project, by that time, there were no FTP UDFs, so curl was the choice.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now