Mosestycoon
5th July 2003 20:54 UTC
.onInstSuccess depending on selected section
Dear Friends -
Is there a way to run something in function .onInstSuccess depending on a package (section) is selected or not?
I would like to give the user the option to start a server (a part of the complete distribution of several servers) after successfull installation. So if the package is selected the option to start the server should be called. If the package was not selected, this part of the .onInstSuccess section should not be called.
How can I achieve this goal?
Cheers Chris
kichik
5th July 2003 21:12 UTC
As always:
!include Sections.nsh
# ...
SectionGetFlags ${secID} $0
IntOp $0 $0 & ${SF_SELECTED}
StrCmp $0 ${SF_SELECTED} run dontRun
If you're using the MUI consider using the finish page and a checkbox to run your program.
Afrow UK
5th July 2003 21:26 UTC
secID;
Section "My section" secID
Mosestycoon
5th July 2003 21:29 UTC
Sorry KichiK -
First question: Are the quotes no longer needed
!include Sections.nsh
Second (also as always :-)):
Where do I have to place the second part of your snippet?
Third:
SF_SELECTED
Has it to be called like that or do I have to replace it?
I am using a CustomPage for that part (server) of the program, where the option can be choosen whether to start or not.
So when the Section including this server is selected and the installation was successfull this option should be able otherwise not.
Remember I am the most powerful non-programmer on earth so please be patient...
Chris
Mosestycoon
5th July 2003 21:30 UTC
@Afrow UK
Thx, even I am the most powerful non-programmer on earth (as mentioned on post above :-)) this little part I understood :D
kichik
5th July 2003 21:37 UTC
There are no spaces in Sections.nsh so the quotes aren't required.
The code should be after the section in the script so that ${secID} will be defined. You need to replace secID with the appropriate name you've assigned. SF_SELECTED is a constant that doesn't need to be replaced.
If you want both the custom page input and the section selection to be taken into consideration just add another check for the custom page result in the "run" label in the code above instead of just running the server.