Archive: InstallOptions error


InstallOptions error
I have encountered some problems with a custom page in my installer, i first tried it without any file in my sections
( ;File ... instead of File ... :) ) and every things worked perfectly :cool: ,
but when i re add the files i want my installer to decompress, the custom page take about 1 minute to appear
and when i finally set my preferences (thanks to checkboxes textbox ...)and clik Next it does install the whole thing
but does not execute the code of the custom page leave function :confused: .

Here is my code :

;Include Modern UI v2
!include "MUI2.nsh"
;Include a Logic Library
!include "LogicLib.nsh"
;Inculde Install Options for the custom pages
!include "InstallOptions.nsh"

...
...

;Interface Settings

!define MUI_ICON install\cstrike.ico
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP install\logo.bmp
!define MUI_WELCOMEFINISHPAGE_BITMAP install\logov.bmp
!define MUI_COMPONENTSPAGE_CHECKBITMAP install\simple-round2.bmp
!define MUI_ABORTWARNING
!define MUI_COMPONENTSPAGE_SMALLDESC

;Pages

!insertmacro MUI_PAGE_WELCOME
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
Page custom ParamAsk ParamSet
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH

;Sections

...
...

;My Custom page :

Function ParamAsk
!insertmacro MUI_HEADER_TEXT "Choisissez les réglagles de Counter-Strike Insalan" "Choisissez ici les options que vous voulez activer pour Counter-Strike"
!insertmacro INSTALLOPTIONS_EXTRACT "options.ini"
!insertmacro INSTALLOPTIONS_DISPLAY "options.ini"
FunctionEnd

Function ParamSet
!insertmacro INSTALLOPTIONS_READ $R1 "options.ini" "Field 1" "State"
!insertmacro INSTALLOPTIONS_READ $R2 "options.ini" "Field 2" "State"
!insertmacro INSTALLOPTIONS_READ $R3 "options.ini" "Field 3" "State"
!insertmacro INSTALLOPTIONS_READ $R4 "options.ini" "Field 4" "State"
!insertmacro INSTALLOPTIONS_READ $R5 "options.ini" "Field 5" "State"
!insertmacro INSTALLOPTIONS_READ $R6 "options.ini" "Field 6" "State"
!insertmacro INSTALLOPTIONS_READ $R7 "options.ini" "Field 7" "State"

FileOpen $0 $INSTDIR\parms.ini w
${If} $R1 == 1
FileWrite $0 "-noforcemspd$\r$\n"
${EndIf}
${If} $R2 == 1
FileWrite $0 "-noforcemaccel$\r$\n"
${EndIf}
${If} $R3 == 1
FileWrite $0 "-noforcemparms$\r$\n"
${EndIf}
${If} $R4 == 1
FileWrite $0 "-freq 75$\r$\n"
${EndIf}
${If} $R5 == 1
FileWrite $0 "-freq 100$\r$\n"
${EndIf}
FileWrite $0 $R6
FileClose $0

${If} $R7 == 1
WriteRegBin HKCU "Control Panel\Mouse" "SmoothMouseXCurve" "000000000000000000a0000000000000004001000000000000800200000000000000050000000000"
WriteRegBin HKCU "Control Panel\Mouse" "SmoothMouseYCurve" "000000000000000066a6020000000000cd4c050000000000a0990a00000000003833150000000000"
${EndIf}
FunctionEnd


And here is my installoptions file :

; Ini file generated by the HM NIS Edit IO designer.
[Settings]
NumFields=15

[Field 1]
Type=Checkbox
Text=-noforcemspd
Left=20
Right=85
Top=15
Bottom=25

[Field 2]
Type=Checkbox
Text=-noforcemaccel
Left=20
Right=85
Top=25
Bottom=35

[Field 3]
Type=Checkbox
Text=-noforcemparms
Left=20
Right=85
Top=35
Bottom=45

[Field 4]
Type=Checkbox
Text=-freq 75
Left=20
Right=85
Top=50
Bottom=60

[Field 5]
Type=Checkbox
Text=-freq 100
Left=20
Right=85
Top=60
Bottom=70

[Field 6]
Type=Text
Left=20
Right=90
Top=75
Bottom=85

[Field 7]
Type=Checkbox
Text=Supprimer l'accélération souris de windows.
Left=20
Right=170
Top=110
Bottom=120

[Field 8]
Type=Label
Text=Paramètres de lancement de Counter-Strike :
Left=0
Right=160
Top=0
Bottom=10

[Field 9]
Type=Label
Text=Désactive la modification de la vitesse de la souris par Half-life.
Left=100
Right=326
Top=17
Bottom=25

[Field 10]
Type=Label
Text=Idem pour l'accélération de la souris.
Left=100
Right=338
Top=26
Bottom=35

[Field 11]
Type=Label
Text=Idem pour l'attribution des touches de la souris.
Left=100
Right=371
Top=36
Bottom=45

[Field 12]
Type=Label
Text=Force le taux de rafraichissement de l'écran �_ 75 Hertz.
Left=100
Right=302
Top=52
Bottom=60

[Field 13]
Type=Label
Text=Force le taux de rafraichissement de l'écran �_ 100 Hertz.
Left=100
Right=306
Top=61
Bottom=70

[Field 14]
Type=Label
Text=Rentrez ici vos paramètres de lancement de CS personalisés.
Left=100
Right=357
Top=75
Bottom=100

[Field 15]
Type=Label
Text=Paramètres de Windows :
Left=2
Right=80
Top=95
Bottom=105


I don't understant why is this working when my sections are empty, and not when i put files in my sections ...

Thank you for your help ;)

No ones know why ?


You need a ReserveFile instruction in there.

Edit: See section 5 in the Modern UI manual.

Stu


Ok, thanks a lot, i din't make the link between this and my problem.


I added a ReserveFile "options.ini" at the beginning of my script, but it still doesn t work whith Solid Lzma (take a while to show the page), and when i remove the flag solid, it shows the custom page correctly but do not always do what's it has to do (ie Writing in $INSTDIR\parms.ini some text) ...
However i think my script for writing in the file is quite simple, is it ?

Still don't understand :S


Regarding to custom pages, I think it's advised to use either MUI along with InstallOptions or MUI2 along with nsDialogs.


In fact, i don't tink my actual problem is due to my CustomPage, but it might be because of it creates a file in the installdir before the whole installation, so maybe it's deleted (:eek:) or the script doesn't have the time to create it, because just after my leave custompage it's the instfiles page.

Just making a suggestion :) .

PS : i'm rewriting the script with nsDialogs in order to check it out.


OK, I solved my problem, it was not due to the custom page but it was caused by the fact that nsis (With FileOpen) seems to not work with opening a file in a a inexistant folder (ig. creating a file in a new folder),it actually creates the folder but it does not create the file.

So I put my piece of script which create this file at the end of the installation(when the folder already exists) with the function ".onInstSuccess".

C ya :cool: