Skip to content
⌘ NSIS Forum Archive

if readINIStr then else?

7 posts

megan19#

if readINIStr then else?

Hi all,

I was wondering if someone could show me how to build this construction?

As in:

ReadINIStr $0 $INSTDIR\winamp.ini winamp outname == nothing?

Basically I want to use this method to verify an existance of an ini file. In MEL, it returns "" if there is no such file, keystring, etc. But not sure about NSIS, so that's why I wrote nothing.


Thanks!!!
empezar#
with LogicLib.nsh

ReadINIStr $0 "$INSTDIR\winamp.ini" winamp outname
${Unless} $0 == ""
MessageBox MB_OK "Value: $0"
${EndUnless}
megan19#
empezar,

Thanks for replying. But I am not sure where to put the else statement?

${Unless} $0 == ""
THEN_STATEMENT...
${EndUnless}
megan19#
Thanks alot Afrow.

IfFileExists $WINDIR\notepad.exe 0 +2
MessageBox MB_OK "notepad is installed"
else do_something??

Where do I place the else statement?


Thanks!!
dienjd#
Use the logic library to be able to use if-else-end logic.

!include LogicLib.nsh

${If} ${FileExists} $WINDIR\notepad.exe
MessageBox MB_OK "notepad found"
${Else}
MessageBox MB_OK "notepad not found"
${EndIf}