Archive: ReadMe on Custom page


ReadMe on Custom page
I am trying to study InstallOptions. I see some things which I can not do.
If somebody used to pass them,please help me!!!!
In my custom page,I have button View Readme.


#==========================================
#DEFINES
#==========================================

!define NAME "Control"
!define MUI_ICON "Control.ico"
!define MUI_INSTFILESPAGE_PROGRESSBAR smooth
!define MUI_HEADERIMAGE
!define MUI_HEADERIMAGE_BITMAP "header.bmp"
!define MUI_UI_HEADERIMAGE "headerbmp.exe"

#==========================================
#INSTALLER INFORMATION
#==========================================

Name "${NAME}"
OutFile "Control.exe"

SetCompressor /SOLID lzma
#SetCompress off
SetCompressorDictSize 32


#==========================================
#INTERFACE SETTINGS
#==========================================

Caption "${NAME}"
BrandingText "2004-2008"
XPStyle On
ShowInstDetails show

#==========================================
#VARIABLES
#==========================================

Var UpdatedFileCount
Var FileSize

#==========================================
#INCLUDES
#==========================================

!include "MUI.nsh"
!include "FileFunc.nsh"
!addplugindir "misc\plugins"
!insertmacro RefreshShellIcons
!insertmacro GetFileVersion

#==========================================
#PAGES
#==========================================

Page custom Control
!define MUI_INSTFILESPAGE_FINISHHEADER_TEXT
!insertmacro MUI_PAGE_INSTFILES

#==========================================
#RESERVE FILES
#==========================================

ReserveFile "mypageen.ini"

#==========================================
#INSTALLER SECTIONS
#==========================================

Section "Desktop"
SectionEnd

#==========================================
#INSTALLER FUNCTIONS
#==========================================

Function .onInit

!insertmacro MUI_INSTALLOPTIONS_EXTRACT "mypageen.ini"
ReadINIStr $0 "$PLUGINSDIR\mypageen.ini" "Settings" "State"

FunctionEnd

Function Control

SetOutPath "$PLUGINSDIR"
!insertmacro MUI_INSTALLOPTIONS_DISPLAY "mypageen.ini"

StrCmp $0 0 ReadMe
Abort
ReadMe:
SetOutPath $PLUGINSDIR
File "c:\test\readme.txt"
ExecWait "readme.txt"
Abort

or run file "googletoolbar.exe"


FunctionEnd


mypageen.ini


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

[Field 1]
Type=Button
Text=ReadMe
Left=2
Right=52
Top=4
Bottom=1


It does not work.

If Someone know please help me!

Thank alot.

So, those things that you can't do, would be.....


You may do it easily with nsdialogs, ex:

outfile test.exe

!include MUI2.nsh
!include nsdialogs.nsh

page custom nsDialogsPage
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_LANGUAGE "English"


Function nsDialogsPage

nsDialogs::Create /NOUNLOAD 1018
Pop $0

${IfThen} $0 == error ${|} Abort ${|}

${NSD_CreateGroupBox} 0u 13u 85% 45% "If you dare click the button"
Pop $R0

${NSD_CreateButton} 140 40u 20% 12u "Read Me!"
Pop $R0

${NSD_OnClick} $R0 ShowReadme

nsDialogs::Show

FunctionEnd


Function ShowReadme

ExecShell open `${NSISDIR}\Docs\nsdialogs\Readme.html`

FunctionEnd


section

sectionend

Thanks Red Wine,

Now I can do it well. However, I have one more question.
In my case, user click on BUTTON 1 to run my application,the other buttons is disable.After finishing process, I want to disable button 1 and enable button 1 to install the second application.
My code here:




Function .onInit

InitPluginsDir
File /oname=$PLUGINSDIR\test.ini test.ini
WriteINIStr "$PLUGINSDIR\test.ini" "Field 2" "Flags" "DISABLED|NOTIFY"

FunctionEnd


Function ShowCustom
InstallOptions::initDialog /NOUNLOAD "$INI"
Pop $0
InstallOptions::show
Pop $0
FunctionEnd


Function LeaveCustom1
ReadINIStr $0 $INI "Settings" "State"
StrCmp $0 1 Button1
StrCmp $0 2 Button2
StrCmp $0 0 ReadMe
Abort
Button1:
SetOutPath $PLUGINSDIR
File "prog\wmp11.exe"
Exec "$PLUGINSDIR\wmp11.exe"

WriteINIStr $INI "Field 1" "Flags" "DISABLED"
WriteINIStr $INI "Field 2" "Flags" ""

Button2:
File "prog\yms9.exe"
Exec "$PLUGINSDIR\yms9.exe"

WriteINIStr $INI "Field 2" "Flags" "DISABLED"
WriteINIStr $INI "Field 3" "Flags" ""

ReadMe:
SetOutPath $PLUGINSDIR
File "prog\readme.txt"
ExecWait "readme.txt"
Abort
FunctionEnd


question:
I do not know how to change state button from disable to enable and otherwise when I has already shown custom page.
In my code, ReadMe part also does not execute file readme.
click Button1 wmp11 not run file.
Your help is very useful for me,
Thank a lot.

I wish I could figure what exactly you're trying to do with this page...
You have assigned the readme execution with the next > button, is this what you want?
You can't use ExecWait "readme.txt", change it to ExecShell open "readme.txt".

I'll suggest again use nsDialogs, it's much easier.

outfile test.exe

!include MUI2.nsh
!include nsdialogs.nsh

page custom nsDialogsPage
!insertmacro MUI_PAGE_INSTFILES

!insertmacro MUI_LANGUAGE "English"


Function nsDialogsPage

nsDialogs::Create /NOUNLOAD 1018
Pop $0

${IfThen} $0 == error ${|} Abort ${|}

${NSD_CreateGroupBox} 0u 13u 85% 45% "If you dare click the button"
Pop $R0

${NSD_CreateButton} 140 25u 20% 12u "Button1"
Pop $R0

${NSD_OnClick} $R0 ExecWmp11

${NSD_CreateButton} 140 41u 20% 12u "Button2"
Pop $R1
EnableWindow $R1 0

${NSD_OnClick} $R1 ExecYms9

${NSD_CreateButton} 140 57u 20% 12u "Read Me!"
Pop $R2

${NSD_OnClick} $R2 ShowReadme

nsDialogs::Show

FunctionEnd

Function ExecWmp11

File /oname=$PLUGINSDIR\wmp11.exe "prog\wmp11.exe"
ExecWait `$PLUGINSDIR\wmp11.exe` $R9

EnableWindow $R0 0
EnableWindow $R1 1

FunctionEnd

Function ExecYms9

File /oname=$PLUGINSDIR\yms9.exe "prog\yms9.exe"
ExecWait `$PLUGINSDIR\yms9.exe` $R9

EnableWindow $R1 0

FunctionEnd

Function ShowReadme

File /oname=$PLUGINSDIR\readme.txt "prog\readme.txt"
ExecShell open `$PLUGINSDIR\readme.txt`

FunctionEnd


section

sectionend

Thank Red Wine very much,
Now I can run my application well.
Thanks again.