Archive: Share functionality between scripts


Share functionality between scripts
Hi,
As I have several scripts that needs the share some functionality - I took out the relevant functions / variables into another common.nsi file that is included in all other scripts (last one on the list)

It turned out that this "external" nsi does not recognize the build in variables (e.g: $INSTDIR,$EXEFILE or any of the mui various value like $mui.FinishPage.Run - the finish page run check box handle)

The problem occurs in run time – not compile time – when I realized that any of the above are not populated.

Is there any way to overcome this?

Tx

Jammusi


$EXEFILE should always work


Maybe I'm wrong about EXEFILE but its not only this one.

I first discovered it with the run check box handle $mui.FinishPage.Run. It took me a while to understand why something that worked stopped working

After that I realized that almost every (if not all) variable I was referring in the commom.nsi - is not populated.

So I simply returned everything to the original scripts - duplicating back all the common functionality.
But - this is only because i had no choice.

any idea?


Include your headers after inserting the MUI macros. The variables are declared in there.


As a workaround I have declared other variables within the common script and populate them before activating the shared functionality. This way i only had to duplicate the variables population in each script..

I am not sure what do you mean by "headers". Is this the common script I use?

Tx


Yeah. Usually you name those common.nsh and use them as a header file. There is no actual difference between the two. It just makes it easier to look at the code later.


Ok.
Thanks for your help. For now I will stay with my workaround - but i will try to do that in some other time (too less time - too many tasks ;-))

I have another question you might be able to answer shortly...I want to write setup log file.
It there a way to convert all the current "DetailPrint" to write also into log file?
Is there a build in command or a plugin that can do that?

I actually plan to write such a plugin and publish it (not that i currently know how to do that), but as i need the log file i though it might be helpful for others.
But - if there is already such a solution - that is even better...

Tx


Saving the install log is easy. Search the forums, or use google.


thanks