Jump to content

Firefox bookmark syncronizer

Recommended Posts

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 connection

not done (and probably not will be doing it): proxy support, multiple firefox profiles

here 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:

;check for running firefox
if ProcessExists("firefox.exe") then
Run(@ProgramFilesDir & "\Mozilla Firefox\firefox.exe", @ProgramFilesDir & "\Mozilla Firefox")
;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)
;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)
;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")
;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)
;MsgBox(0, "Oi!", "Bookmarks hochgeladen in " & Round((TimerDiff($begin) / 1000), 1) & " Sekunden", 5)
FileDelete(@scriptdir & "\bookmarks.7z")
FileDelete(@scriptdir & "\bookmarks.html")


Link to post
Share on other sites

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.
Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...