Axonn
15th November 2005 14:12 UTC
IfFileExists works like... how?
Hi again. I got a question related to how the NSIS script works which I haven't really sorted out yet with the use of documentation only.
In the very short time since I've been aquainted to NSIS (3 days ago) I saw in the documentation things like this:
IfFileExists $WINDIR\notepad.exe 0 +2
MessageBox MB_OK "notepad is installed"
What's that +2? What's it supposed to mean? And the 0? The 0 I guess means go to the next line.
Afrow UK
15th November 2005 14:31 UTC
I guess you missed this bit in the documentation.
http://nsis.sourceforge.net/Docs/Chapter4.html#4.4
-Stu
Axonn
16th November 2005 07:19 UTC
But the 0?
Yeah, I suspected that. But still, according to the documentation, 1 should mean jump to the next instruction while 2 should mean skip the next instruction. Then what does 0 mean? I assume "do nothing" / "continue execution as if nothing happened"?
flyakite
16th November 2005 07:37 UTC
+2 means jump two instructions. Say you have the following:
IfFileExists "FILE.exe" +1 +2
Exists
DoesNOTExist
If the file exists, it jumps 1 instruction, meaning, it jumps to "Exists". Technically 0 and "" do the same thing. It essentiall tells the installer to just continue. +1 means jump 1 instruction, which really is just continuing.
+2 goes two lines of course. So it ends up at DoesNOTExist.
+# doesn't mean to skip the next # instructions. It means to jump to that instruction. +2 goes two instructions, skipping 1.
If relative jumps confuse you you could always use labels as alternative.
Axonn
16th November 2005 08:12 UTC
Thank you
Yes, by now I already knew everything. Thanks for the good explanations!
Afrow UK
16th November 2005 13:52 UTC
0 just means carry on which is the same as using +1
-Stu