Skip to content
⌘ NSIS Forum Archive

Initializing variable and using

4 posts

daisywheel#

Initializing variable and using

I want to initialize variable and use it in my script.
I do the following

Var /GLOBAL SourcePath

Function .onInit
StrCpy $SourcePath "C:\1"
FunctionEnd

!insertmacro MUI_PAGE_LICENSE $SourcePath\license.rtf

I get next error
!insertmacro: MUI_PAGE_LICENSE
LicenseData: open failed "$SourcePath\license.rtf"

While ny code is comiled ok with
!insertmacro MUI_PAGE_LICENSE c:\1\license.rtf

Have I done something wrong?

Thanks,
Roman
Red Wine#
This is a common misunderstood 🙂
Variables take action at runtime you can't use 'em in compile time since they're empty.

Use a definition instead.