Old 28th July 2012, 09:50   #1
nawfal
Junior Member
 
Join Date: Jul 2012
Posts: 22
Correct usage of $(AndIfNot)

I tried in vain this:

code:
1 ${IfNot} ${SectionIsSelected} ${Section2}
2 ${AndIfNot} ${SelectionIsSelected} ${Section4}
3 Abort
4 ${EndIf}



What I want is I want to exit a function if both section 2 and section 4 are unselected. But the above code doesnt compile saying there is an error in line 2 required 4 parameters, passed 3. How to do this logic correctly?
nawfal is offline   Reply With Quote
Old 28th July 2012, 11:19   #2
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
First of all, you cannot use abort to break out of a functioncall. You'll have to use a goto functionend instead.

Second, ${AndIfNot} ${SelectionIsSelected} ${Section4} is correct, assuming ${Section4} is defined. Do you get a warning about non-existing defines? But the error in "line 2" does not make sense. Did you mean in [i]macroline[i] 2? What is the exact error from the compiler?
MSG is offline   Reply With Quote
Old 28th July 2012, 11:52   #3
nawfal
Junior Member
 
Join Date: Jul 2012
Posts: 22
1. I got the Abort call from Show custom page when a section has been selected link. I am using it in the function to display my custom IO page (by writing Abort I am not displaying the page). And it is working too (like returning from a function, not actually aborting the installation itself). What is abort meant for then?


2. The error I am getting is below:

Quote:
Function: "Hi"
!insertmacro: _If
!insertmacro: end of _If
!insertmacro: _And
!insertmacro: macro "_And" requires 4 parameter(s), passed 3!
Error in script "D:\Project\CTVI\CTVI\Setup\New Text Document.nsi" on line 33 -- aborting creation process
No, section 4 is properly defined. I get the function executed if I am not using AndIfNot. I am attaching a simple installer code that will reproduce the error I posted above.
Attached Files
File Type: nsi New Text Document.nsi (1.6 KB, 150 views)
nawfal is offline   Reply With Quote
Old 28th July 2012, 12:05   #4
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
You've written "SelectionIsSelected" instead of "SectionIsSelected".

Stu
Afrow UK is offline   Reply With Quote
Old 28th July 2012, 12:10   #5
nawfal
Junior Member
 
Join Date: Jul 2012
Posts: 22
Smile

omGGGGGGGG....... Ooops, I copy pasted from somewhere!

Infact turned out to be your own post
nawfal is offline   Reply With Quote
Old 28th July 2012, 15:15   #6
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 5,321
Quote:
Originally Posted by MSG View Post
First of all, you cannot use abort to break out of a functioncall. You'll have to use a goto functionend instead.
You can use Return, or if you want to set the abort flag you can use Abort...

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Old 29th July 2012, 07:17   #7
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Quote:
Originally Posted by Anders View Post
or if you want to set the abort flag you can use Abort...
Unless you're in an nsDialogs callback function, of course. >__<
MSG is offline   Reply With Quote
Old 29th July 2012, 08:25   #8
nawfal
Junior Member
 
Join Date: Jul 2012
Posts: 22
See section 4.5.3 in the manual, Abort call can be used to not show a custom page..
nawfal is offline   Reply With Quote
Old 29th July 2012, 08:44   #9
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Err oops, sorry my bad. The 'quit' command doesn't work in nsDialogs callbacks (like onClick etc). Not sure about abort.
MSG is offline   Reply With Quote
Old 29th July 2012, 11:49   #10
Afrow UK
Moderator
 
Afrow UK's Avatar
 
Join Date: Nov 2002
Location: Surrey, England
Posts: 8,434
Yes calling Abort in the custom page show function has the same effect as not showing the page (thereby skipping it).

Edited my post

Stu
Afrow UK is offline   Reply With Quote
Old 29th July 2012, 14:42   #11
demiller9
Senior Member
 
Join Date: Mar 2006
Location: Dallas
Posts: 462
Quote:
Originally Posted by Afrow UK View Post
Edited my post

Stu
Rewriting history, Stu?

The post you fixed is one of four that had 'SelectionIsSelected'. Posts # 31, 33, and 36 on that old thread still have that slip.

Don
demiller9 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Tags
checkbox, logiclib, section, selected

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump