Old 7th February 2005, 15:48   #1
peterob
Junior Member
 
Join Date: Feb 2005
Posts: 2
Serial number custom page

Hi everyone,

I discovered this program today, and am quite impressed. It seems able to do everything I require, but I'm having a little difficulty with one thing.

Basically, I want to use a custom page where the user enters his serial number, and install the appropriate options based on that. It's not really a copy protection scheme (the user still needs to activate the product), more of a way to incorporate everything in one installation package.

Here's an example of the function I'm using (I'll put a dll call in later, just a StrCmp for now...):

PHP Code:
Function SerialPage

loop
:
  !
insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
  
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "serial.ini"
    
    
ReadINIStr $INI_VALUE "$PLUGINSDIR\serial.ini" "Field 2" "State"
  
StrCmp $INI_VALUE "07" exit 
    
WriteINIStr "$PLUGINSDIR\serial.ini" "Field 2" "State" "" 
goto loop

exit:
FunctionEnd 
It works, in so far as if the user does not enter "07" (in this example) in the text control I placed, the page will clear the serial and reload the page (dialogs etc to be added).

My problem occurs when the user clicks the "Cancel" button. The installer will only quit when a valid serial number has been entered. Is there another way to do this? Can I trap the Cancel button? I've hit a bit of a blank.

Thanks in advance

Pete.
peterob is offline   Reply With Quote
Old 7th February 2005, 18:58   #2
Comm@nder21
Major Dude
 
Join Date: Jul 2003
Location: germany, b-w
Posts: 734
Send a message via ICQ to Comm@nder21
think, the solution is also posted in various readmes.
the thing is, to check, WHICH button is pressed.
you'll do this with the following code:

code:
!insertmacro MUI_INSTALLOPTIONS_READ $0 "serial.ini" "Settings" "State"
StrCmp $0 "1" +2
Return
...



also, you should NOT use the code you currently do have.

have a look at the install options readme and the official docs and read the sections about custom pages, the leave function and abort calls there!!
Comm@nder21 is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump