Archive: Going MORE than Slightly Mad


Going MORE than Slightly Mad
  Hi Guys

Approximately 12 hours into my installer script, I now have no finger nails on my left hand (from nervous biting), and have been pulling large clumps of hair from my head for the past 2 hours.

My problem is thus:
I am using an HTTP POST request to a server to verify a product key. I have downloaded the PassDialog plugin which works great, except that all the examples simply end by generating a message box with what the user entered. So, I wrote a function to verify if the server response was good or bad. So far so good!

If the server response is bad I simply call the custom page function to return the user back to the product key page to have another go. Well, this works the first time round, but the second attempt sends the user on to the install page. This is BAD!

Can someone PLEASE explain to me how I keep this loop going until a good server response is generated?

At this rate I will be down to the bone on my fingers and will have to wear a hat to work today to cover up all the bald spots....please, please HELP.

NSI is attached - Thanks


I see that you call verify function by Page Custom verify. Try to do verification in SerialPageLeave function and if verification is "BAD" then reload your "SerialPage". Use RelGotoPage for reloading pages.


To go back to the serial page, call Abort. Do NOT call the function again. Similarely, you should only use RelGotoPage (WM_NOTIFY_OUTER_NEXT) if you have no other option.

Stu


How simple! I really didn't know about this feature... :rolleyes: Thanks!


Thanks guys for clearing up the Abort vs Call issue. I will use Abort to return to the Serial Page.

Pospec:
Thanks for the advice about the RelGotoPage (WM_NOTIFY_OUTER_NEXT) function. I will give this a go.

Stu:
Can you please clarify something for me...
How does the script know it should jump back to the Serial Page simply by calling Abort, and what other options are there to RelGotoPage?

As far as I can tell, the program flow as it stands is thus:
1 Init and Defines
2 Standard Welcome Pages
3 Custom Serial Pages calling custom functions
4 Standard Install Pages which use the Section "Install"

What I cannot figure out is how to keep the loop going so we stay with the custom functions until a good server response is generated. I seem to be able to do this just once, before the script jumps to the Install section.

Don't get me wrong, I am an experienced programmer of over ten years, but after using NSIS for only one day, this whole program flow thing has be baffled.....

Thanks again for your help chaps.


Guys

Thank you so much for your help!
After some more learning I have now fixed my script and all is working great.

Cheers


Just to clarify, when Abort is called in any pages' pre function, it will jump over that page. When Abort is called in any pages' leave function it will go back to the previous page, without reloading it. As custom pages do not have pre functions, calling Abort in their show function has the same effect to skip over the page. You can also simple skip over the InstallOptions/nsDialogs/PassDialog/whatever plug-in call to skip a custom page.

Stu


custom pages do not have pre functions
Really? I am confused if they haven't...

MUI_PAGE_CUSTOMFUNCTION_PRE function

>MUI_PAGE_CUSTOMFUNCTION_SHOW function
>MUI_PAGE_CUSTOMFUNCTION_LEAVE function

custom pages only have create and leave, but you can emulate pre and show in the create function

Function MyCustomPageCreate
;PRE code here
!insertmacro INSTALLOPTIONS_INITDIALOG "ioFile.ini"
Pop $HWND ;HWND of dialog
;SHOW code here
!insertmacro INSTALLOPTIONS_SHOW
FunctionEnd

Page Custom MyCustomPageCreate

(If you are using modern ui, you also want to set the header text and stuff probably)