I am working on a macro and script to make a reserve (backup) copy of the profile and the registry.dat file. I have tried it on all the installs that I have a home but I do not know if I have covered all the possible locations. I do not have a multiple user setup.
I would like some testing and feedback prior to putting this system in the MacroLibary. I will include the proposed notes, macro and script file and hope that someone will test and let me know how it works for them.
ResProfile Notes
ResProfile.kmm will allow a copy of the user’s K-Meleon profile to be written to a location of the user’s choice. The K-Meleon file, Registery.dat, is also copied to the same location.
The menu item for ResProfile is found in the Tools menu.
The copy activity occures after K-Meleon is stopped. This is because K-Meleon, while running, has write permission to some profile files. The copy activity is delayed three seconds after the OnQuit event in K-Meleon to give time for any writes to the files to finish. The user should not restart K-Meleon until there has been time for the script file to complete.
There is also a ProfileBackup installable extention by Guenter at Alain Aupeix’s site.
http://pagesperso-orange.fr/jujuland46/JujuLand/KMES/KMES-Download.html#down_extensions
Open your User Macro Folder (Edit > Configuration > User-Defined Macros) or your Macro Folder (Edit > Configuration > Macros) and create the following text files:
ResProfile.kmm
# K-Meleon Macros (http://kmeleon.sourceforge.net/wiki/index.php?id=MacroLanguage)
#
# ---------- ResProfile.kmm
# ---------- K-Meleon Macro Language make a reserve copy of your profile ---------------
#
# Dependencies : main.kmm
# Resources : ResProfile.js
# Preferences : -
# Version : 0.8.5 2007-12-06
# --------------------------------------------------------------------------------
ResProfile_RunCode {
$_ResProfile_Cur_Profile_Path = getfolder(ProfileFolder);
$_ResProfile_Reserve_Path = promptforfolder( "Select a folder for your Reserve Profile.\nIt is best to make a separate folder.\nThe folder does not need to be within K-Meleon." , getfolder(RootFolder) );
$_ResProfile_Reserve_Path ==""? &_ResProfile_Cancel : &_ResProfile_ValidateNotSameFolder;
}
# PRIVATE --------------
# set global variables
$_ResProfile_Staged_Flag = false;
$_ResProfile_Cur_Profile_Path = "dummy" ;
$_ResProfile_Reserve_Path = "dummy" ;
_ResProfile_Cancel {
$ResProfile_Button=confirm("Did you mean to cancel?","Affirm cancel" ,YESNO,QUESTION);
$ResProfile_Button == "YES" ? 0 : &_ResProfile_RunCode ;
}
_ResProfile_ValidateNotSameFolder {
$_ResProfile_Cur_Profile_Path == $_ResProfile_Reserve_Path ? &_ResProfile_ReDo : &_ResProfile_Staged ;
}
_ResProfile_ReDo {
alert("Target of copy should not be\n\nthe profile folder.","Copy to itself",EXCLAIM);
&_ResProfile_RunCode ;
}
_ResProfile_Staged {
$_ResProfile_Staged_Flag = true ;
}
_ResProfile_ExitRun {
$_ResProfile_Staged_Flag == true ? exec("wscript.exe \"".$_ResProfile_Path."\" \"".$_ResProfile_Cur_Profile_Path."\" \"".$_ResProfile_Reserve_Path."\"") : 0 ;
}
_ResProfile_BuildMenu{
setmenu("&Tools",macro,"Reserve Profile",ResProfile_RunCode,Misc);
}
_ResProfile_GetPath{
### ResProfile.js is supposed to be located in the same folder as ResProfile.kmm (this file).
### If it isn't, Windows Script Host will notify the user.
### Double underscore makes variable local only.
$__Data=readfile(getfolder(MacroFolder)."\\ResProfile.kmm");
$_ResProfile_Path=getfolder($__Data==""?UserMacroFolder:MacroFolder)."\\ResProfile.js";
}
$OnQuit=$OnQuit."_ResProfile_ExitRun;";
$OnStartup=$OnStartup."_ResProfile_GetPath;";
$OnInit=$OnInit."_ResProfile_BuildMenu;";
$macroModules=$macroModules."ResProfile;";
Resprofile.js
/* ResProfile.js by JamesD, version 0.8.7 2007-12-11
This script is a helper application for the K-Meleon Macro Module ResProfile.kmm that
enables you to make a reserve ( backup ) copy of your profile [<unique name>.slt].
The KM registry.dat file is also copied to the reserve profile folder.
Windows Script Host 2.0 (or better) required!
WSH is part of Microsoft Internet Explorer 5.0 and newer. Latest version of WSH is
available at http://msdn.microsoft.com/scripting/
*/
var c, r, i, RegF, RegFTwo ;
var overwrite = 1 ;
var Current_Profile_Path = WScript.Arguments(0);
var Reserve_Profile_Path = WScript.Arguments(1);
var objfso = new ActiveXObject("Scripting.FileSystemObject");
WScript.Sleep( 3000) ;
if (objfso.FolderExists(Current_Profile_Path)) { c = "exists" ; }
if (objfso.FolderExists(Reserve_Profile_Path)) { r = "exists" ; }
if (c == "exists" && r == "exists") {objfso.copyfolder(Current_Profile_Path, Reserve_Profile_Path, overwrite); }
i = Current_Profile_Path.indexOf("Profiles");
if ( i == -1) {i = Current_Profile_Path.indexOf("profiles"); }
RegF = Current_Profile_Path.substring(0, i+8) ;
RegF = RegF + "\\\\Registry.dat" ;
RegFTwo = Reserve_Profile_Path + "\\\\Registry.dat" ;
if (objfso.FileExists( RegF)) {objfso.copyfile(RegF, RegFTwo, overwrite); }
else {
i = Current_Profile_Path.indexOf("K-Meleon");
if (i== -1) {i = Current_Profile_Path.indexOf("k-meleon"); }
RegF = Current_Profile_Path.substring(0, i+8) ;
RegF = RegF + "\\\\Registry.dat" ;
RegFTwo = Reserve_Profile_Path + "\\\\Registry.dat" ;
if (objfso.FileExists( RegF)) {objfso.copyfile(RegF, RegFTwo, overwrite); }
else { WScript.echo("No correct path found for Registry.dat/nor/nRegistry.dat is missing"); }
}