Go Back   Winamp Forums > Developer Center > NSIS Discussion

Reply
Thread Tools Search this Thread Display Modes
Old 18th December 2002, 13:21   #1
HelluvaEngineer
Junior Member
 
Join Date: Jun 2002
Posts: 25
Call Function only if two sections selected

What's the most efficient way to call a function only if two sections have been selected by the user, using SectionGetFlags? Sorry if this is a dumb question, I just figured there was some way to do it quickly with an IntOp & operation.
HelluvaEngineer is offline   Reply With Quote
Old 18th December 2002, 13:53   #2
HelluvaEngineer
Junior Member
 
Join Date: Jun 2002
Posts: 25
Ooops, actually meant if one OR the other is selected. What I am trying to do is check the selections from the user. They can install documentation only if one or another part of an SDK was selected. Will this work?:

PHP Code:
SectionGetFlags ${SDKDOC$R1
IntOp $R2 $R1 
0x80000000
IntCmp $R2 0 Skip
    SectionGetFlags 
${CPPSDK$R1
    SectionGetFlags 
${COMSDK$R2
    IntOp $R3 $R1 
$R2    
    IntCmp $R3 0x80000000 Skip
        Call InstallSDKDocStartShortcuts
Skip

HelluvaEngineer is offline   Reply With Quote
Old 18th December 2002, 14:09   #3
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,336
This should do it:

PHP Code:
SectionGetFlags ${SDK_PART1} $0
SectionGetFlags 
${SDK_PART2} $1
IntOp 
$$| $0
# SECTION_SELECTED should be defined according to the NSIS version
IntOp $$& ${SECTION_SELECTED}
StrCmp $${SECTION_SELECTED0 nonSelected
  
# do whatever you want to do if one or the other is selected
  
Goto done
nonSelected
:
  
# do whatever you want to do if non is selected
done

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 18th December 2002, 14:09   #4
HelluvaEngineer
Junior Member
 
Join Date: Jun 2002
Posts: 25
Also tried

PHP Code:
SectionGetFlags ${CPPSDK$R1
SectionGetFlags 
${COMSDK$R2
IntOp $R3 $R1 
$R2    
IntOp $R4 $R3 
0x80000000
IntCmp $R4 0 Skip 
Still no luck. It always installs if it enters this segment.
HelluvaEngineer is offline   Reply With Quote
Old 18th December 2002, 14:22   #5
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,336
From where are you trying to call this code? I would suggest you call it from .onSelChange, and uncheck the docs section if non of the two SDK sections are selected.

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 18th December 2002, 14:29   #6
HelluvaEngineer
Junior Member
 
Join Date: Jun 2002
Posts: 25
OK, the last bit of code works. Another section was calling that function.
HelluvaEngineer is offline   Reply With Quote
Old 18th December 2002, 15:05   #7
HelluvaEngineer
Junior Member
 
Join Date: Jun 2002
Posts: 25
Absolutely correct. I decided to pull this function. In the future, I will readdress it by using OnSelectChange, so that the user is aware of what's going on.

As a side note, I didn't realize that StrCmp worked for these comparisons. I was only using IntCmp. I will keep that in mind for the future.

Thanks!
HelluvaEngineer is offline   Reply With Quote
Reply
Go Back   Winamp Forums > Developer Center > NSIS Discussion

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