nsis

Can't use Pop to get control variable


Several examples show how to store a created control in a variable (Check Official documentation, or this answer for example).

But in my script, the NSIS compiler is failing right at the pop. Here is part of my script :

nsDialogs::Create 1018
Pop $Dialog

${If} $Dialog == error
        Abort
${EndIf}

${NSD_CreateLabel} 0 10u 100% 12u "There is a new feature available in this version called Fuse."
${NSD_CreateLabel} 0 22u 100% 12u "It makes your whole Mega Cloud Drive being available directly from Windows Explorer."
${NSD_CreateLabel} 0 34u 100% 12u "In order to use it, you need to install WinFSP. Do you want to install WinFSP?"

${NSD_CreateCheckbox} 30u 70u 100% 12u "Install WinFSP"
Pop $checkbox

;${If} $Checkbox_State == ${BST_CHECKED}
;    ${NSD_Check} $Checkbox
;${EndIf}

Var /GLOBAL installWinFSP
StrCpy $installWinFSP "Y"

nsDialogs::Show

And here is the error I get :

warning: !warning: LangString "MULTIUSER_INNERTEXT_INSTALLMODE_ALLUSERS" for language Welsh is missing, using fallback from "C:\Program Files (x86)\NSIS\Contrib\Language files\English.nsh" (macro:LANGFILE_SETSTRING:7)
warning: !warning: LangString "MULTIUSER_INNERTEXT_INSTALLMODE_CURRENTUSER" for language Welsh is missing, using fallback from "C:\Program Files (x86)\NSIS\Contrib\Language files\English.nsh" (macro:LANGFILE_SETSTRING:7)
warning 6000: unknown variable/constant "installWinFSP" detected, ignoring (macro:_==:1)
Usage: Pop $(user_var: output)
Error in script "installer_win.nsi" on line 311 -- aborting creation process

NOTE : the failure is in the Pop $checkbox line, the Pop $Dialog works fine.

Any ideas on what is the problem?


Solution

  • The output Usage: Pop $(user_var: output) let assume that the variable you've passed to the function is invalid, with better words: it is not defined yet. Ensure that the variable has been declared using the VAR keyword before using it the first time (as per the comments, this was why Pop $Dialog worked but Pop $checkbox not).