 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
k3ph
Joined: 20 Jul 2006 Posts: 174
|
Posted: Wed Jun 18, 2008 2:37 pm Post subject: Firefox Profile Backuper |
|
|
[ Information ]
This is my old simple batch profile backuper ported to AHK.
It works with any version of Firefox
**Tested with Firefox 2 and Firefox 3**
Notes for Devs: oh yeah, some people asking me about to mod this script, feel free to do whatever ;) enjoy.
[ Screenshot ]
[ Download ]
fpb.v01.ahk - size: 2.36KB
fpb.exe - size 179KB
[ Source ]
| Code: | #NoEnv
SendMode Input
SetTitleMatchMode 2
SetWorkingDir %A_ScriptDir%
#SingleInstance Force
#Persistent
#NoTrayIcon
debug = 0
version = v01
backup = %A_ScriptDir%\backup
profilesfile := % A_AppData . "\Mozilla\Firefox\profiles.ini"
Gui,Add,Text,, [ guidraft by ChalamiuS && code by k3ph ]`n[ thanks to derRaphael && Titan ]
Gui,Add,Text,, The following files will be backuped:
Gui,Add,Text,, bookmarks.html - Bookmarks.`n prefs.js - Current user preferences.`n user.js - User-added preferences (overrides prefs.js every startup).`n signons.txt - Saved passwords.`n key3.db - Supplements password file.`n cert8.db - Needed for key3.db file
Gui,Add,Text,, Information regarding to upgrade:
Gui,Add,Text,, the file bookmarks.html can be directly copied in the new profile folder.`n Its not recommended copying to a different version of Firefox: user.js and prefs.js files. `n Copying signons.txt, key3.db and cert8.db are recommended only with same Firefox versions.
Gui,Add,Button,gbackup x50 y170 v1,backup
Gui,Add,Button,gExit x140 y170 v2,exit
Gui,Show,w470 h270, Firefox Profile Backuper
GuiControl,Move,1,% "y" 266*0.90
GuiControl,Move,2,% "y" 266*0.90
return
backup:
IfExist, %profilesfile%
FileRead, maindata, %profilesfile%
count := 0
Loop, parse, maindata, `n, `r
{
founded := RegExMatch(A_LoopField, "Profile\d+", match)
If match
if ErrorLevel = 0
count++
matches .= match
}
profiles := RegExReplace(matches, "(?<!^)(Profile\d+)", "|$1")
Gui, 2:Add, ListBox, vProfile gAddProfile, %profiles%
Gui, 2:Show,, choose profile
return
AddProfile:
If (A_GuiEvent = "Normal")
return
Gui,2:Submit
Gui,2:Destroy
if (Profile == "") {
msgbox please select a profile
reload
} else {
if (debug = 1) {
MsgBox, %count% profiles detected`nChosen List: %A_EventInfo%`nProfile: %Profile%
}
iniread, profilespath, %profilesfile%, %Profile%, Path
stringreplace, profilespath, profilespath, Profiles/, , All
path = %A_AppData%\Mozilla\Firefox\Profiles\%profilespath%\
if (debug = 1) {
MsgBox, ProfilesPath: %profilespath%`nAbsolute Path: %path%
}
IfNotExist, %backup%
FileCreateDir, %backup%
files = bookmarks.html,signons.txt,prefs.js,user.js,bookmarks.html,key3.db,cert8.db
loop, Parse, files, `,
{
FileCopy, %path%\%A_LoopField%, %backup%
}
gosub exit
}
return
exit:
ExitApp
return |
additional for greasemonkey scripts:
| Code: | | FileCopy, %A_AppData%\Mozilla\Firefox\Profiles\%profilespath%\gm_scripts\*.js, %backup%\gm_scripts |
[ keywords ]
firefox, ff1, ff2, ff3, backup _________________ [ profile | ahk.net | ahk.talk ]
Last edited by k3ph on Wed Jun 18, 2008 3:17 pm; edited 1 time in total |
|
| Back to top |
|
 |
Chala
Joined: 29 Mar 2008 Posts: 11
|
Posted: Wed Jun 18, 2008 3:05 pm Post subject: |
|
|
k3ph you modified the gui you made it look odd
If you want it to look normal in 120dpi you'll have to modify it yourself
It looks quite normal with the correct code in 96dpi
| Code: |
#NoEnv
SendMode Input
SetTitleMatchMode 2
SetWorkingDir %A_ScriptDir%
#SingleInstance Force
#Persistent
#NoTrayIcon
debug = 0
version = v01
backup = %A_ScriptDir%\backup
profilesfile := % A_AppData . "\Mozilla\Firefox\profiles.ini"
Gui,Add,Text,, [ guidraft by ChalamiuS && code by k3ph ]`n[ thanks to derRaphael && Titan ]
Gui,Add,Text,, The following files will be backuped:
Gui,Add,Text,, bookmarks.html - Bookmarks.`n prefs.js - Current user preferences.`n user.js - User-added preferences (overrides prefs.js every startup).`n signons.txt - Saved passwords.`n key3.db - Supplements password file.`n cert8.db - Needed for key3.db file
Gui,Add,Text,, Information regarding to upgrade:
Gui,Add,Text,, the file bookmarks.html can be directly copied in the new profile folder.`n Its not recommended copying to a different version of Firefox: user.js and prefs.js files. `n Copying signons.txt, key3.db and cert8.db are recommended only with same Firefox versions.
Gui,Add,Button,gbackup x10 y170 v1,Backup
Gui,Add,Button,gExit x70 y170 v2,Exit
Gui,Show,w470 h270, Firefox Profile Backuper
GuiControl,Move,1,% "y" 270*0.90
GuiControl,Move,2,% "y" 270*0.90
return
backup:
IfExist, %profilesfile%
FileRead, maindata, %profilesfile%
count := 0
Loop, parse, maindata, `n, `r
{
founded := RegExMatch(A_LoopField, "Profile\d+", match)
If match
if ErrorLevel = 0
count++
matches .= match
}
profiles := RegExReplace(matches, "(?<!^)(Profile\d+)", "|$1")
Gui, 2:Add, ListBox, vProfile gAddProfile, %profiles%
Gui, 2:Show,, choose profile
return
AddProfile:
If (A_GuiEvent = "Normal")
return
Gui,2:Submit
Gui,2:Destroy
if (Profile == "") {
msgbox please select a profile
reload
} else {
if (debug = 1) {
MsgBox, %count% profiles detected`nChosen List: %A_EventInfo%`nProfile: %Profile%
}
iniread, profilespath, %profilesfile%, %Profile%, Path
stringreplace, profilespath, profilespath, Profiles/, , All
path = %A_AppData%\Mozilla\Firefox\Profiles\%profilespath%\
if (debug = 1) {
MsgBox, ProfilesPath: %profilespath%`nAbsolute Path: %path%
}
IfNotExist, %backup%
FileCreateDir, %backup%
files = bookmarks.html,signons.txt,prefs.js,user.js,bookmarks.html,key3.db,cert8.db
loop, Parse, files, `,
{
FileCopy, %path%\%A_LoopField%, %backup%
}
gosub exit
}
return
exit:
ExitApp
return
|
|
|
| Back to top |
|
 |
shajul
Joined: 15 Sep 2006 Posts: 33 Location: India
|
Posted: Wed Jun 18, 2008 5:54 pm Post subject: Very nice script - suggestions! |
|
|
Thanks k3ph, works absolutely fine!!
i usually backup my entire profiles folder, so that it can be restored in totality! adding an option to do that will not be difficult! |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|