Skip to content
⌘ NSIS Forum Archive

How to check $INSTALLERNAME

4 posts

dTomoyo#

How to check $INSTALLERNAME

Hi~

How to check $INSTALLERNAME ?

I tried to use under code.

FindFirst $0 $1 $EXEDIR\inst*.exe
StrCmp $1 'inst1234.exe' GoodName CheckRetry
CheckRetry:
FindNext ???
StrCmp ? 'inst1234.exe GoodName
Goto CheckRetry
ErrorInst:
MessageBox MB_OK "Error! Installer File is corrupted."
Abort
GoodName:
inst1234.exe = $INSTALLERNAME

but, can't get installer name in $EXEDIR.

please, help me.
F. Heidenreich#
Hi dTomoyo,

I've added some lines of code and now I think you could check your installername 😉
Name "Installer 1234"
OutFile inst1234.exe

Function .onInit
FindFirst $0 $1 $EXEDIR\inst*.exe
StrCmp $1 'inst1234.exe' GoodName CheckRetry
CheckRetry:
FindNext $0 $1
StrCmp $1 '' ErrorInst
StrCmp $1 'inst1234.exe' GoodName ErrorInst
Goto CheckRetry
ErrorInst:
MessageBox MB_OK "Error! Installer File is corrupted."
Abort
GoodName:
FunctionEnd

Section
MessageBox MB_OK "Have a good time 🙂"
SectionEnd
~ Florian
F. Heidenreich#
But you could have the same behaviour by this short script:
Name "Installer 1234"
OutFile inst1234.exe

Function .onInit
IfFileExists $EXEDIR\inst1234.exe GoodName ErrorInst
ErrorInst:
MessageBox MB_OK "Error! Installer File is corrupted."
Abort
GoodName:
FunctionEnd

Section
MessageBox MB_OK "Have a good time 🙂"
SectionEnd
~ Florian