Skip to content
⌘ NSIS Forum Archive

IfFileExists then macro

6 posts

safl#

IfFileExists then macro

Hello,

I don't quite get the some of the basics 🙂

Is it not possible to do a:

IfFileExists "$INSTDIR\sc_update"
!insertmacro "Remove_${SEC01}"

It is in uninstall process, i just want to run remove macro if file is found.

Regards,
Simon
kichik#
Use LogicLib:
!include LogicLib.nsh
# ...
${If} ${FileExists} $INSTDIR\sc_update
!insertmacro Remove_${SEC01}
${EndIf}
safl#
Great works like a charm.
Is there any way to do something as simple for checking whether a section is check or not?
safl#
Sry for my horrible english.

What i want to do is execute 3 commands if a section is selected. i wan't to do this inside one section.

I've been scavaging the docs/forum but can't seem to find what i need.

I want to be able to something like:

IfSectionChecked {writeIniStr, writeIniStr, WriteIniStr}
safl#
I guess i should do some more reading..
I've tried with:

${If} ${SectionIsSelected} ${SEC03}
WriteIniStr DIR GROUP KEY VALUE
${EndIf}

But the value get's written regardless of the section is checked or not 🙁
kichik#
Make sure SEC03 has the correct value in there. Add:
!error ${SEC03}
If the output comes out as:
!error: ${SEC03}
then it's not defined and you need to move that code below the section definition.