Archive: How to record[store] property values in nsis?


How to record[store] property values in nsis?
I have created exe file using nsis.Its working fine as expected.Now i'm wondering.

In my script i have 3 pages of reading and writing configuration property.I have used text box for reading and writing.If the user clicks exe file its installed successfully.

My problem:
If the exe file have any update i need to do the update process using silent installer[No interaction].In that case i have to use same set of conf property values as earlier used.I donot know how to keep or store values something like recording or something else.Also if the user wants to add more property in silent installer that also want to do.

How to keep[record] configure property values in nsis ?


To save information between two installation sessions, you can either save to a file or save to registry. For the commands to do this, read chapter 4.9.2 of the manual:
http://nsis.sourceforge.net/Docs/Chapter4.html#4.9.2

To let the user supply info to a silent installer, you can use command line parameters.


Thanks @MSG.can you explain more with sample code?

Function .onInit
!ifdef IsSilent
SetSilent silent
!endif
FunctionEnd

I have use this code for running silent and non-silent mode.
First i have run non-silent mode change configuration property values.Next time i have run silent mode the configuration property revert back to default values.so In that case i need to keep the values temporarily and restore values when its needed?
I have use below code for reading values from property file.
Function settings
InstallOptions::dialog "$PLUGINSDIR\Access.ini"
ReadINIStr $test "$PLUGINSDIR\Access.ini" "Field 1" "State"
ReadINIStr $sample "$PLUGINSDIR\Server.Access.ini" "Field 4" "State"
FunctionEnd

Below code writing the values to the conf property.
Function written
${ConfigWrite} "$INSTDIR\conf.properties" "Acess" "=$test" $R3
;$R3=CHANGED
${ConfigWrite} "$INSTDIR\conf.properties" "sampletest" "=$sample" $R4
;$R4=CHANGED
FunctionEnd

How to save this values in file or registry?


You can simply use FileWrite to write one line (setting) to a txtfile. Then use FileRead in a loop to read all written settings.


Thanks MSG. i will try.