- NSIS Discussion
- Custom Page
Archive: Custom Page
Sp33dy Gonzale$
3rd July 2005 13:30 UTC
Custom Page
Hy I would make an custom page. The page has an checkbox and when the checkbox is actived I would replace an text in a line.
( http://nsis.sourceforge.net/wiki/Rep...le_line_number )
But how can I do this ?
Then I would like that some checkboxes are current actived and some how are current not actived.
Pls help me
Sp33dy Gonzale$
3rd July 2005 15:23 UTC
Hy,
I've tryed to write the code but there must be somthing wrong. It comes always an error.
What is wrong?
Page custom FeauturesPage PageLeaveFeautures
; Funtions
Function .onInit
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "feautures.ini"
FunctionEnd
Function RIF
ClearErrors ; want to be a newborn
Exch $0 ; REPLACEMENT
Exch
Exch $1 ; SEARCH_TEXT
Exch 2
Exch $2 ; SOURCE_FILE
Push $R0 ; SOURCE_FILE file handle
Push $R1 ; temporary file handle
Push $R2 ; unique temporary file name
Push $R3 ; a line to sar/save
Push $R4 ; shift puffer
IfFileExists $2 +1 RIF_error ; knock-knock
FileOpen $R0 $2 "r" ; open the door
GetTempFileName $R2 ; who's new?
FileOpen $R1 $R2 "w" ; the escape, please!
RIF_loop: ; round'n'round we go
FileRead $R0 $R3 ; read one line
IfErrors RIF_leaveloop ; enough is enough
RIF_sar: ; sar - search and replace
Push "$R3" ; (hair)stack
Push "$1" ; needle
Push "$0" ; blood
Call StrReplace ; do the bartwalk
StrCpy $R4 "$R3" ; remember previous state
Pop $R3 ; gimme s.th. back in return!
StrCmp "$R3" "$R4" +1 RIF_sar ; loop, might change again!
FileWrite $R1 "$R3" ; save the newbie
Goto RIF_loop ; gimme more
RIF_leaveloop: ; over'n'out, Sir!
FileClose $R1 ; S'rry, Ma'am - clos'n now
FileClose $R0 ; me 2
Delete "$2.old" ; go away, Sire
Rename "$2" "$2.old" ; step aside, Ma'am
Rename "$R2" "$2" ; hi, baby!
ClearErrors ; now i AM a newborn
Goto RIF_out ; out'n'away
RIF_error: ; ups - s.th. went wrong...
SetErrors ; ...so cry, boy!
RIF_out: ; your wardrobe?
Pop $R4
Pop $R3
Pop $R2
Pop $R1
Pop $R0
Pop $2
Pop $0
Pop $1
FunctionEnd
; Feautures Page
Function FeauturesPage
!insertmacro MUI_HEADER_TEXT "Konfiguration des Erweiterungs System" "Wählen sie die Plugins aus, die aktiviert werden sollen."
FunctionEnd
; Page Leave Feautures
Function PageLeaveFeautures
!insertmacro MUI_INSTALLOPTIONS_READ $R0 "feautures.ini" "Field 1" "State"
StrCmp $R0 "1" 0 +2
!insertmacro ReplaceInFile "$INSTDIR\cstrike\addons\amxmodx\configs\pausecfg.ini" "AntiCamping Advanced" "AntiCamping Advanced 2"
FunctionEnd
Afrow UK
3rd July 2005 16:34 UTC
You need to put:
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "feautures.ini"
in the FeauturesPage function under !insertmacro MUI_HEADER_TEXT
Also,
StrCmp $R0 "1" 0 +2
!insertmacro ReplaceInFile "$INSTDIR\cstrike\addons\amxmodx\configs\pausecfg.ini" "AntiCamping Advanced" "AntiCamping Advanced 2"
will not work. the ReplaceInFile macro will contain more than one command, so you need to do:
StrCmp $R0 "1" 0 noReplace
!insertmacro ReplaceInFile "$INSTDIR\cstrike\addons\amxmodx\configs\pausecfg.ini" "AntiCamping Advanced" "AntiCamping Advanced 2"
noReplace:
Finally, where's the ReplaceInFile !macro? Have you put it in your code?
-Stu
Sp33dy Gonzale$
3rd July 2005 18:57 UTC
Yes IT WORKS
Thank you Affrow UK.
Only one question:
Is it possible to start the custom page only if the Section Mod was activited and installed?
Thank you
Afrow UK
4th July 2005 09:11 UTC
Yes of course. You need to jump over the !insertmacro MUI_INSTALLOPTIONS_DISPLAY call like so:
!include Sections.nsh
; Feautures Page
Function FeauturesPage
!insertmacro SectionFlagIsSet ${Mod} ${SF_SELECTED} Display Skip
Display:
!insertmacro MUI_HEADER_TEXT "Konfiguration des Erweiterungs System" "Wählen sie die Plugins aus, die aktiviert werden sollen."
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "feautures.ini"
Skip:
FunctionEnd
-Stu
Sp33dy Gonzale$
5th July 2005 13:59 UTC
Hy
thank you for your answer
But there is a problem I always become an warning unknown variable {Mod} ignoring...
I've tried to write
!include "Sections.nsh"
; Feautures Page
Function FeauturesPage
!insertmacro SectionFlagIsSet ${2(because it is section2)} ${SF_SELECTED} Display Skip
Display:
!insertmacro MUI_HEADER_TEXT "Konfiguration des Erweiterungs System" "Wählen sie die Plugins aus, die aktiviert werden sollen."
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "feautures.ini"
Skip:
FunctionEnd
But it doesn't works
Sp33dy Gonzale$
5th July 2005 17:10 UTC
Thank you it works
Sp33dy Gonzale$
5th July 2005 17:13 UTC
Yes I know I've a lot of questions
Sorry
But can I add an description like in the MUI_PAGE_COMPONENTS with MUI_COMPONENTSPAGE_SMALLDESC ?
Afrow UK
5th July 2005 17:15 UTC
Add a description for..?
-Stu
Sp33dy Gonzal$
5th July 2005 19:10 UTC
Ah sure I haven't write . Sry
My custom Page has 6 Checkboxes and I would like when the user move with the mouse over one of the checkboxes an description of the checkbox comes.
This is my feautures.ini (This is only one Field but I've six)
[Settings]
NumFields=1
[Field 1]
Type=Checkbox
Text=Enhanced-Death Plugin
This Should be in the description like in the components description:
(Roter Bildschirm wenn man stirbt)
State=1
Left=149
Right=308
Top=3
Bottom=17
Afrow UK
5th July 2005 19:29 UTC
This isn't possible with standard InstallOptions.
It's probably possible with InstallOptionsEx, but there it gets more complicated.
-Stu