![]() |
NSIS Navigate through functions
Hello,
I am trying to setup an NSIS installer that reboots during the middle of my installation, then when the PC is rebooted the program will automatically continue the installation then when its finished it will pop-up the FINISH page. I have succesfully managed to write my installer to the registry, with an argument so it could launch on the next reboot with the following code: Function CPAGEFINISH IfRebootFlag 0 noreboot !define MUI_FINISHPAGE_NOAUTOCLOSE !define MUI_FINISHPAGE_TITLE "Installation Half-Done" !define MUI_FINISHPAGE_TEXT "The installation is not complete but needs to reboot before going \ on. Do you want to reboot now or wait until later to finish this?" !define MUI_FINISHPAGE_TEXT_REBOOTNOW "Reboot now" !define MUI_FINISHPAGE_TEXT_REBOOTLATER "I want to manually reboot later" StrCpy $varRebootNext 1 System::Call 'kernel32::GetModuleFileNameA(i 0, t .R0, i 1024) i r1' ;$R0 will contain the installer filename WriteRegStr HKLM Software\Microsoft\Windows\CurrentVersion\Run "SurfsUpDS" "$R0 /STAGE2" I have no idea how to make my program start from a specific Section after the PC is rebooted. I've tried the GetParameters and goto, but it never worked. I would like to have something like that: Function .onInit Call GetParameters Pop $R1 ${if} $R0 == "STAGE2" goto SectionAFTERREBOOT I know this code won't work but I would like to do something similar. Thanks |
I am not sure how to go to a specific section, but if you wanted to run something from your .onInit, I was thinking that this should work: write a flag somewhere on the system registry before rebooting, read this flag during .onInit and if it exists then go to a specific point within your .onInit. The flag could be a number, incremented for every reboot, so you could redirect the installer to a different section every time (if you want say to restart more than once). You could also define some parameter and then setup your sections conditionally so that they would not be executed upon reboot. Something like this:
Hope this helpscode: CF |
Let's say for sake of argument the $Value variable holds the value you pass to it. And using your example, let's say a value of "Stage2" means we want to go to run section.
This might be the code: code: |
| All times are GMT. The time now is 05:12. |
Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.