General :  K-Meleon Web Browser Forum
General discussion about K-Meleon 
Locations for KM's Registry.dat file
Posted by: JamesD
Date: December 12, 2007 03:08PM

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");  }
         }
       



Options: ReplyQuote
Re: Locations for KM's Registry.dat file
Posted by: JujuLand
Date: December 12, 2007 09:12PM

The only locations of registry.dat is:

%USERPROFILE%\Application Data\K-Meleon

where %USERPROFILE% is the content of the environment variable
or

<K-Meleon root folder>\Profiles

But I really don't understand the reason of backing up a complete profile folder and the list of profiles.

It would be interesting only if the profile reinit bug delete all the structure of the profiles folder.

A+



Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:38.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/76.0


Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc



Options: ReplyQuote
Re: Locations for KM's Registry.dat file
Posted by: JamesD
Date: December 12, 2007 11:01PM

@ JujuLand

On my laptop with KM 1.1.3 the Profiles folder was spelled with lowercase p. Since my old eyes and brain saw what I expected to see, it took me some time to discover why the script failed there. Profiles was spelled with an uppercase P on my desktop machine.

As to why copy the whole profile, it is because I was lazy. One copy folder method was less coding than a group of copy file methods. Also I was not sure how much of the folder might be needed in order to restore a profile which had been damaged.

I am not sure about the "list of profiles". What is the list of profiles?

Options: ReplyQuote
Re: Locations for KM's Registry.dat file
Posted by: JujuLand
Date: December 13, 2007 08:22AM

à JamesD

Do you want to say that if in this line and others:

> Current_Profile_Path.indexOf("profiles");

profiles is written Profiles, it doesn't work ?
Curious, as it's pure os system, and upper/lower case has no importance.

> One copy folder method was less coding than a group of copy file methods.

Yes, but it's already made :-)

> I am not sure about the "list of profiles". What is the list of profiles?

registry.dat contains the list and the description of profiles.

A+



Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:38.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/76.0


Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc



Options: ReplyQuote
Re: Locations for KM's Registry.dat file
Posted by: JamesD
Date: December 13, 2007 12:13PM

@ JujuLand

The script did not work where profiles was lowercase until I added code to handle lowercase.
i = Current_Profile_Path.indexOf("Profiles");
if ( i == -1) {i = Current_Profile_Path.indexOf("profiles"); }
Without the second line i got the value of -1 and the script failed. I cannot understand how the path on the laptop got a lowercase folder name. Your are right that the OS does not care if upper or lower case, but the indexOf method seems to be case sensitive.

Thanks for the info on what is contained in Registry.dat. Notepad shows me nothing readable.

Options: ReplyQuote
Re: Locations for KM's Registry.dat file
Posted by: desga_2
Date: December 13, 2007 06:52PM

If you have profile.ini file you profile is in 'path' value and this can be changed by users:

[Profile]
path=Profiles
isrelative=1

Options: ReplyQuote
Re: Locations for KM's Registry.dat file
Posted by: JujuLand
Date: December 13, 2007 07:56PM

Quote
Thanks for the info on what is contained in Registry.dat. Notepad shows me nothing readable

use pspad instead :-)

Quote

If you have profile.ini file you profile is in 'path' value and this can be changed by users:

There is not a lot of people who modify this, but I agree, this can be done, and the value if the file is here must be read.

A+



Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:38.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/76.0


Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc





Edited 1 time(s). Last edit at 12/13/2007 07:57PM by JujuLand.

Options: ReplyQuote
Re: Locations for KM's Registry.dat file
Posted by: JamesD
Date: December 14, 2007 01:36PM

@ JujuLand

Thank you for all the information. I am going to remove the copying of Registry.dat from the script file. Based on a request for someone to preserve their Registry.dat file in this thread http://kmeleonbrowser.org/forum/read.php?3,75092,76119#msg-76119 I assigned a level of importance to that file which was not warranted.

I guess I caused the lowercase P in profiles. I copied the code for Profile.ini from some thread, but I don’t remember which. How this all came about reads like a comedy of errors. My brother-in-law gave me his old laptop computer when he got a new one. He was typing at the keyboard when we loaded KM onto the computer. He lets the operating system not show known extensions. When I told him to make a Profile.ini file in the KM folder he did not select all file before he saved. Therefore the empty file was saved as Profile.ini.txt, but the txt extension was not shown. The profile showed up in Documents and Settings. In trying to fix that I copied three lines of code to the file and it still did not change. I finally discovered the txt on the end of the file name and fixed that but left the lines of code in the file. The profile was made inside of KM but had the lowercase profile folder name.

I have changed the laptop's operating system such that it show all file extensions.

Options: ReplyQuote
Re: Locations for KM's Registry.dat file
Posted by: JujuLand
Date: December 14, 2007 08:52PM

Quote

When I told him to make a Profile.ini file
This win options is really a ... I don't remember in english, but in french we say ... saloperie. Really bad.

I suppose now you have no more troubles with upper/lower case ?

A+



Mozilla/5.0 (x11; U; Linux x86_64; fr-FR; rv:38.0) Gecko/20100101 Ubuntu/12.04 K-Meleon/76.0


Web: http://jujuland.pagesperso-orange.fr/
Mail : alain [dot] aupeix [at] wanadoo [dot] fr



Ubuntu 12.04 - Gramps 3.4.9 - Harbour 3.2.0 - Hwgui 2.20-3 - K-Meleon 76.0 rc



Options: ReplyQuote


K-Meleon forum is powered by Phorum.