Archive: editing text vars


editing text vars
I want to edit some variables in text file after installation inside custom page before finish page.
Custom page (see attached file) must include vars and fields to edit path to applications.
Vars stored in vars.ini file in $INSTDIR\cfg\.
Need help to make this custom page!


It really isn't hard to make custom InstallOptions dialogues. Please read the Contrib\InstallOptions\Readme.html documentation and see the examples in Contrib\InstallOptions and Examples.

-Stu


OK I'v made *.ini file for my custom page.
Next - what command i must to use to read var and var's path from vars.ini - ReadINIStr or fileopen/read/write. And what will installer do after I choose custom path to var. Will it automatic save new path to vars.ini when I push OK button in file select dialog or next button in installer window.


vars.ini exsample:
var1 "path to app1"
var2 "path to app2"
var3 "path to app3"


ReadINIStr $R0 "$PLUGINSDIR\vars.ini" "Field X" "State"

The values are saved on the custom page directly to the ini file when the user clicks the Next button. You should read the values from the ini file on the custom page's Leave function. Here you can verify entered information (ie paths exist) and call Abort to jump back to the custom page if necessary.

e.g.

Page Custom myCustomPage myCustomPageLeave

Function .onInit
InitPluginsDir
ReserveFile "/oname=$PLUGINSDIR\vars.ini" "vars.ini"
FunctionEnd

Function myCustomPage
InstallOptions::dialogue "$PLUGINSDIR\vars.ini"
Pop $R0
FunctionEnd

Function myCustomPageLeave

ReadINIStr $R0 "$PLUGINSDIR\vars.ini" "Field 2" "State"
StrCmp $R0 "" +2
IfFileExists "$R0\*.*" +3
MessageBox MB_OK|MB_ICONSTOP "The path entered in Var1 does not exist!"
Abort

ReadINIStr $R0 "$PLUGINSDIR\vars.ini" "Field 4" "State"
StrCmp $R0 "" +2
IfFileExists "$R0\*.*" +3
MessageBox MB_OK|MB_ICONSTOP "The path entered in Var2 does not exist!"
Abort

ReadINIStr $R0 "$PLUGINSDIR\vars.ini" "Field 6" "State"
StrCmp $R0 "" +2
IfFileExists "$R0\*.*" +3
MessageBox MB_OK|MB_ICONSTOP "The path entered in Var3 does not exist!"
Abort

FunctionEnd


-Stu

One more question - how to change text in header of custom page. I see text from previous page header and couldnt find any info about it in help files.


You can use the MUI_HEADER_TEXT macro (!insertmacro MUI_HEADER_TEXT "blah" "ja") if your installer isn't multilingual, else see the section entitled "Custom pages" in the Modern UI readme.

-Stu