add optional AutoRun page to installer
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 25 KiB |
@@ -0,0 +1,47 @@
|
|||||||
|
[Settings]
|
||||||
|
NumFields=5
|
||||||
|
|
||||||
|
[Field 1]
|
||||||
|
Type=Button
|
||||||
|
Flags=NOTIFY
|
||||||
|
Text=&Install
|
||||||
|
Left=160
|
||||||
|
Right=-10
|
||||||
|
Top=50
|
||||||
|
Bottom=70
|
||||||
|
|
||||||
|
[Field 2]
|
||||||
|
Type=Button
|
||||||
|
Flags=NOTIFY
|
||||||
|
Text=&Play
|
||||||
|
Left=160
|
||||||
|
Right=-10
|
||||||
|
Top=30
|
||||||
|
Bottom=50
|
||||||
|
|
||||||
|
[Field 3]
|
||||||
|
Type=Button
|
||||||
|
Flags=NOTIFY
|
||||||
|
Text=&Re-Install
|
||||||
|
Left=160
|
||||||
|
Right=-10
|
||||||
|
Top=60
|
||||||
|
Bottom=80
|
||||||
|
|
||||||
|
[Field 4]
|
||||||
|
Type=Link
|
||||||
|
Text=http://www.urlhere.com
|
||||||
|
State=http://www.urlhere.com
|
||||||
|
Left=160
|
||||||
|
Right=-10
|
||||||
|
Top=130
|
||||||
|
Bottom=140
|
||||||
|
|
||||||
|
[Field 5]
|
||||||
|
Type=Bitmap
|
||||||
|
Text=custom.bmp
|
||||||
|
Flags=TRANSPARENT
|
||||||
|
Left=0
|
||||||
|
Right=150
|
||||||
|
Top=0
|
||||||
|
Bottom=120
|
||||||
@@ -13,3 +13,4 @@
|
|||||||
!define PRODUCT_URL "http://www.stepmania.com"
|
!define PRODUCT_URL "http://www.stepmania.com"
|
||||||
|
|
||||||
;!define INSTALL_TYPE_PCKS
|
;!define INSTALL_TYPE_PCKS
|
||||||
|
;!define SHOW_AUTORUN
|
||||||
|
|||||||
+99
-2
@@ -61,6 +61,10 @@
|
|||||||
;--------------------------------
|
;--------------------------------
|
||||||
;Pages
|
;Pages
|
||||||
|
|
||||||
|
!ifdef SHOW_AUTORUN
|
||||||
|
Page custom ShowCustom LeaveCustom
|
||||||
|
!endif
|
||||||
|
|
||||||
;!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
|
;!insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Docs\Modern UI\License.txt"
|
||||||
;!insertmacro MUI_PAGE_COMPONENTS
|
;!insertmacro MUI_PAGE_COMPONENTS
|
||||||
!insertmacro MUI_PAGE_DIRECTORY
|
!insertmacro MUI_PAGE_DIRECTORY
|
||||||
@@ -329,9 +333,80 @@ SectionEnd
|
|||||||
;--------------------------------
|
;--------------------------------
|
||||||
;Installer Functions
|
;Installer Functions
|
||||||
|
|
||||||
Function .onInit
|
LangString TEXT_IO_TITLE ${LANG_ENGLISH} "InstallOptions page"
|
||||||
|
LangString TEXT_IO_SUBTITLE ${LANG_ENGLISH} "This is a page created using the InstallOptions plug-in."
|
||||||
|
|
||||||
!insertmacro MUI_LANGDLL_DISPLAY
|
Var hwnd ; Window handle of the custom page
|
||||||
|
|
||||||
|
Function ShowCustom
|
||||||
|
|
||||||
|
!insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
|
||||||
|
|
||||||
|
InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\custom.ini"
|
||||||
|
; In this mode InstallOptions returns the window handle so we can use it
|
||||||
|
Pop $hwnd
|
||||||
|
|
||||||
|
GetDlgItem $1 $HWNDPARENT 1 ; Next button
|
||||||
|
ShowWindow $1 0
|
||||||
|
|
||||||
|
|
||||||
|
StrCpy $R1 "$INSTDIR\uninst.exe"
|
||||||
|
StrCpy $R2 "_="
|
||||||
|
IfFileExists "$R1" uninstall_available
|
||||||
|
StrCpy $R1 "$INSTDIR\uninstall.exe"
|
||||||
|
StrCpy $R2 "_?="
|
||||||
|
IfFileExists "$R1" uninstall_available
|
||||||
|
|
||||||
|
GetDlgItem $1 $hwnd 1201 ; Second cutom control
|
||||||
|
ShowWindow $1 0
|
||||||
|
GetDlgItem $1 $hwnd 1202 ; Third cutom control
|
||||||
|
ShowWindow $1 0
|
||||||
|
Goto uninstall_done
|
||||||
|
|
||||||
|
uninstall_available:
|
||||||
|
GetDlgItem $1 $hwnd 1200 ; First cutom control
|
||||||
|
ShowWindow $1 0
|
||||||
|
|
||||||
|
uninstall_done:
|
||||||
|
|
||||||
|
; Now show the dialog and wait for it to finish
|
||||||
|
InstallOptions::show
|
||||||
|
|
||||||
|
; Finally fetch the InstallOptions status value (we don't care what it is though)
|
||||||
|
Pop $0
|
||||||
|
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function LeaveCustom
|
||||||
|
|
||||||
|
; At this point the user has either pressed Next or one of our custom buttons
|
||||||
|
; We find out which by reading from the INI file
|
||||||
|
ReadINIStr $0 "$PLUGINSDIR\custom.ini" "Settings" "State"
|
||||||
|
StrCmp $0 1 install
|
||||||
|
StrCmp $0 2 play
|
||||||
|
StrCmp $0 3 install
|
||||||
|
Goto proceed
|
||||||
|
|
||||||
|
install:
|
||||||
|
Call PreInstall
|
||||||
|
GoTo proceed
|
||||||
|
|
||||||
|
play:
|
||||||
|
Exec "$INSTDIR\Program\${PRODUCT_NAME}.exe"
|
||||||
|
IfErrors play_error
|
||||||
|
quit
|
||||||
|
|
||||||
|
play_error:
|
||||||
|
MessageBox MB_ICONEXCLAMATION "Could not execute $INSTDIR\Program\${PRODUCT_NAME}.exe"
|
||||||
|
abort
|
||||||
|
|
||||||
|
proceed:
|
||||||
|
GetDlgItem $1 $HWNDPARENT 1 ; Next button
|
||||||
|
ShowWindow $1 1
|
||||||
|
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
|
Function PreInstall
|
||||||
|
|
||||||
; force uninstall of previous version using NSIS
|
; force uninstall of previous version using NSIS
|
||||||
; We need to wait until the uninstaller finishes before continuing, since it's possible
|
; We need to wait until the uninstaller finishes before continuing, since it's possible
|
||||||
@@ -394,6 +469,28 @@ Function .onInit
|
|||||||
|
|
||||||
FunctionEnd
|
FunctionEnd
|
||||||
|
|
||||||
|
Function .onInit
|
||||||
|
|
||||||
|
; Show language selection for debugging
|
||||||
|
;!insertmacro MUI_LANGDLL_DISPLAY
|
||||||
|
|
||||||
|
!ifdef SHOW_AUTORUN
|
||||||
|
;
|
||||||
|
; Extract files for the InstallOptions page
|
||||||
|
;
|
||||||
|
!insertmacro MUI_INSTALLOPTIONS_EXTRACT_AS "Installer\custom.ini" "custom.ini"
|
||||||
|
;$PLUGINSDIR will automatically be removed when the installer closes
|
||||||
|
InitPluginsDir
|
||||||
|
WriteINIStr $PLUGINSDIR\custom.ini "Field 4" "Text" "${PRODUCT_URL}"
|
||||||
|
WriteINIStr $PLUGINSDIR\custom.ini "Field 4" "State" "${PRODUCT_URL}"
|
||||||
|
File /oname=$PLUGINSDIR\image.bmp "Installer\custom.bmp"
|
||||||
|
WriteINIStr $PLUGINSDIR\custom.ini "Field 5" "Text" $PLUGINSDIR\image.bmp
|
||||||
|
!else
|
||||||
|
call PreInstall
|
||||||
|
!endif
|
||||||
|
|
||||||
|
FunctionEnd
|
||||||
|
|
||||||
;--------------------------------
|
;--------------------------------
|
||||||
;Descriptions
|
;Descriptions
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user