Archive: Which came first the Chicken ot the Egg?


Which came first the Chicken ot the Egg?
I am trying to resolve a circular argument problem in my script. The order of things is as follows
---------------

IsSectionFlagSet Macro

UninstallHelpFiles Macro (inserts my macro 'IsSectionFlagSet')

Section secHelpFiles (inserts UninstallHelpFiles Macro)

Uninstall Section (inserts UninstallHelpFiles macro)


.onInit Section (checks the Help Files check box if installed last time)
-------------------

The problem is that my UninstallHelpFiles macro need to be below the Section Definition so that when it is inserted {secHelpFiles} is set to the actual section number.

If this IS below the section definitions then the section cannot call the UninstallHelpFiles Macro because it hasn't been defined yet.

I am sure that my script is probably not very efficient but I'm a bit stuck as to how to resolve it - can anyone point me in the right direction?


Can't you just move both macro's under your Sections or am I missing something?

-Stu


It is more complicated than that because my section inserts the UninstallHelpFiles macro so fails compilation because this is defined below it.


Would you be able to attach your code?

-Stu


Here it is!


Hmm yeh that is a problem.
The only way to get around this would be to replace:
!insertmacro IsSectionFlagSet ${secHelpFiles}
...with...
!insertmacro IsSectionFlagSet 1

If you like, make a new !define secHelpFilesIndex 1 and use that.

Currently your secHelpFiles section is the second section in your script, so its index is 1 (zero based)

-Stu


I obviously wanted to avoid doing that so that maintaining the script would be easier but if that is the only way then so be it!

Thanks.