Archive: Functions for saving/loading settings to/from registry


Functions for saving/loading settings to/from registry
Hi, I'm working on an installer with 5 pages and 14 checkboxes per page (using MUI custompages) and I want the installer to be able to remember the selected checkboxes by storing them in the registry. I was hoping someone could help me create 2 functions: one for saving settings to the registry and the other for loading them from the registry. This is probably easy to do, but I don't know my way around loops, which I think is the best way to do this since the pages are named options1.ini --> options5.ini and there are 14 fields in each page. I'd appreciate any help offered. Thanks.


Use ReadRegStr and WriteRegStr for the registry parts, then ReadINIStr and WriteINIStr for the INI files.

-Stu


http://nsis.sourceforge.net/wiki/RememberComponents


Ok thanks, well I'm almost done. I finished the SaveSettings function however, the LoadSettings function isn't working. Is there something wrong with the following:

ReadRegStr $R0 HKCU "Software\LTP\${CURRENT_VER}" "$R2-$R3"


because $R0 is returning a null result while I check the registry and it should have a numeric value. At this point, I checked and am sure that $R2 and $R3 have their correct values.

ReadRegStr can read only string values. Use ReadRegDWORD if you are reading integers, which is probable to happen in this case. If this is not enough, say which type has your value name.


I'd go into RegEdit and see if you can browse to HCKU\software\LTP\${CURRENT_VER} and read what $R2-$R3 is.

If that doesn't work, you can insert a message box just before the command to see what the string "Software\LTP\${CURRENT_VER}" and "$R2-$R3" actually are at the time the command is being called.

EDIT: Deguix also has a good point!