Archive: How to Display Sections in One Order During Selection, Yet Execute In a Diff Order?


How to Display Sections in One Order During Selection, Yet Execute In a Diff Order?
How do you display selections to a user in one order

X. prog1
X. prog2
X. prog3
X. prog4

BUT, execute them on install in a different order?

X. prog4
X. prog3
X. prog2
X. prog1

Did I make any sense?

I need to show my sections to a user in a particular order. BUT, in the order that they appear to the user is in no way how the sections are actually executed when a user installs.

How do I achieve this effect? Any help is greatly appreciated!


How does this look? Should do the trick.


Var DoProg1
Var DoProg2
Var DoProg3
Var DoProg4


Section /O "prog1" SEC01
StrCpy DoProg1 Yes
SectionEnd

Section /O "prog2" SEC02
StrCpy DoProg2 Yes
SectionEnd

Section /O "prog3" SEC03
StrCpy DoProg3 Yes
SectionEnd

Section /O "prog4" SEC04
StrCpy DoProg4 Yes
SectionEnd


Section "-DoProg4"
StrCmp DoProg4 Yes 0 End
bla bla bla
End:
SectionEnd

Section "-DoProg3"
StrCmp DoProg3 Yes 0 End
bla bla bla
End:
SectionEnd

Section "-DoProg2"
StrCmp DoProg2 Yes 0 End
bla bla bla
End:
SectionEnd

Section "-DoProg1"
StrCmp DoProg1 Yes 0 End
bla bla bla
End:
SectionEnd

Rather than use variables which take up more memory, just use SectiongetFlags to see if the dummy sections are selected or not.

-Stu


I think Jnuw's example is making most sense to me right now. Afrow, How would you apply SectiongetFlags to his example?

If possible, is there a method that will not require me to move my sections about? The reason I ask is because several sections need only to be reorganized and they're each located in a different SectionGroup.

Thanks Jnuw and Thanks Afrow!


Section /O "prog1" SEC01
StrCpy DoProg1 Yes
SectionEnd

Section /O "prog2" SEC02
StrCpy DoProg2 Yes
SectionEnd

Section /O "prog3" SEC03
StrCpy DoProg3 Yes
SectionEnd

Section /O "prog4" SEC04
StrCpy DoProg4 Yes
SectionEnd


Section "-DoProg4"
SectionGetFlags $R0 ${SEC04}
StrCmp $R0 0 End
bla bla bla
End:
SectionEnd

Section "-DoProg3"
SectionGetFlags $R0 ${SEC03}
StrCmp $R0 0 End
bla bla bla
End:
SectionEnd

Section "-DoProg2"
SectionGetFlags $R0 ${SEC02}
StrCmp $R0 0 End
bla bla bla
End:
SectionEnd

Section "-DoProg1"
SectionGetFlags $R0 ${SEC01}
StrCmp $R0 0 End
bla bla bla
End:
SectionEnd

-Stu


Thank you Afrow,

Some minute work was needed to get it running but you granted me a head start. Thanks!


Sorry, noticed SectionGetFlags arguments are in wrong order. I'll check documents in future :)

-Stu


You could also use the SectionFlagIsSet macro from Sections.nsh. Or even better, the SectionIsSelected macro from the LogicLib:

${If} ${SectionIsSelected} ${SEC01}
#...
${EndIf}

Hey Kichik, can you show me a small example of the best idea you have on this? Perhaps using just two sections? I'll try to figure out the rest!

Afrow, It's a good thing, I did the minor tweaks to make it work. You still jumped me ahead of myself big time. Thanks :)


kichik is saying you can use that to check if a section is selected or not (like using SectionGetFlags)

E.g.

!include LogicLib.nsh

Section "-DoProg1"
${If} ${SectionIsSelected} ${SEC01}
bla bla bla
${EndIf}
SectionEnd

-Stu


Thanks Afrow, I should have tried but guess I needed confirmation. Thanks for everything!