Skip to content
⌘ NSIS Forum Archive

Problew writing variable values to ini file.

9 posts

mmleyr#

Problew writing variable values to ini file.

Good day.

Code:
Section
${if} $PllS == ${Pll1}
StrCpy $Pll "30000"
${else}
StrCpy $Pll "20000"
${EndIf}
SectionEnd

Section
Push "#FPLL := $Pll" #text to be replaced
Push "FPLL := $Pll" #replace with
Push all #replace all occurrences
Push all #replace all occurrences
Push $INSTDIR\config\Chip.mk #file to replace in
Call AdvReplaceInFile
SectionEnd

Function summary
!insertmacro MUI_INSTALLOPTIONS_WRITE ioA.ini 'Field 2' State "PLL frequency in kHz: $Pll .\r\n"
;or WriteINIStr $PLUGINSDIR\ioA.ini 'Field 2' State "PLL frequency in kHz: $Pll .\r\n"
FunctionEnd

expected result:
after choice are made installer will show a page on which would be displayed
PLL frequency in kHz: 30000 (or 20000) .

real result:
installer shows page
PLL frequency in kHz: .

Question: why the variable's value isn't inserted in ini file.

Thx in advance. 🙂

Best regards.
mmleyr#
!define MUI_PAGE_CUSTOMFUNCTION_PRE ComponentsPage0Pre
!insertmacro MUI_PAGE_COMPONENTS

!define MUI_PAGE_CUSTOMFUNCTION_PRE ComponentsPage1Pre
!insertmacro MUI_PAGE_COMPONENTS

!define MUI_PAGE_CUSTOMFUNCTION_PRE ComponentsPage2Pre
!insertmacro MUI_PAGE_COMPONENTS

Page custom summary

; Directory page
!insertmacro MUI_PAGE_DIRECTORY
; Instfiles page
!define MUI_FINISHPAGE_NOAUTOCLOSE
!insertmacro MUI_PAGE_INSTFILES
; Finish page
!insertmacro MUI_PAGE_FINISH
; Uninstaller pages
!insertmacro MUI_UNPAGE_INSTFILES
Afrow UK#
Well there you go then. How can you expect $Pll to have a value when your sections are executed after your custom page?

Stu
mmleyr#
so, when i put my custom page AFTER instfiles page - it work fine.

but the problem is that i need it to be displayed BEFORE instfiles and before directory page.

Best regards.
Afrow UK#
Sections are executed on the InstFiles page only, in which case move the code in your section to the summary function.

Stu
mmleyr#
....erm, Afrow UK, maybe you can give me some example based on my first post in this thread, please? 🙂

Best regards.
Afrow UK#
Function summary
${If} $PllS == ${Pll1}
StrCpy $Pll "30000"
${Else}
StrCpy $Pll "20000"
${EndIf}
!insertmacro MUI_INSTALLOPTIONS_WRITE ioA.ini 'Field 2' State "PLL frequency in kHz: $Pll .\r\n"
FunctionEnd
Stu