Skip to content
⌘ NSIS Forum Archive

Construct variables?

3 posts

highend#

Construct variables?

Hi,

I want to define a few registry paths at the beginning of the script and loop over these paths later on.

!Include "LogicLib.nsh"

Section "Main"

Var /GLOBAL regPathCount
Var /GLOBAL regPath_1
Var /GLOBAL regPath_2

StrCpy $regPathCount "2" ; Edit number and add / remove paths accordingly
StrCpy $regPath_2 "[HKEY_CURRENT_USER\Software\Sysinternals\Share Enum]"
StrCpy $regPath_1 "[HKEY_CURRENT_USER\Software\Sysinternals\ShareEnum]"

StrCpy $R0 $regPathCount
${While} $R0 >= 1
MessageBox MB_OK|MB_ICONEXCLAMATION "$regPath_$R0"
IntOp $R0 $R0 - 1
${EndWhile}
SectionEnd
That doesn't work. Is there a way to construct the necessary variable names inside the loop?
T.Slappy#
For working with large data sets use nsArray plug-in which will work in loop for you.

NSIS currently supports only GLOBAL variables so your example will not work.