使用electron开发应用程序之后,经常会单独对windows做32位或者是64位程序打包操作,有时候默认的程序做不了相应的需求,往往需要添加单独的页面或者是修改默认的操作,比如一下添加一个默认的选择页面:
自定义脚本代码如下所示:
!define MUI_LANGUAGE "Chinese"
Unicode true
!include nsDialogs.nsh
!include LogicLib.nsh
#OutFile nsDialogs.exe
#RequestExecutionLevel user
#ShowInstDetails show
Var Dialog
Var Bool_mysql
Var Bool_java
;mysql
Var Ck_mysql
;java
Var Ck_java
Page custom pgPageCreate pgPageLeave
Function pgPageCreate
nsDialogs::Create 1018
Pop $Dialog
${If} $Dialog == error
Abort
${EndIf}
${NSD_Createcheckbox} 50u 0u 70u 20u "mysql"
Pop $Ck_mysql
StrCpy $1 $Ck_mysql
GetFunctionAddress $3 OnClick_CheckMysql
nsDialogs::onClick $1 $3
StrCpy $Bool_mysql 0
${NSD_Createcheckbox} 50u 40u 70u 20u "java"
Pop $Ck_java
StrCpy $1 $Ck_java
GetFunctionAddress $3 OnClick_CheckJava
nsDialogs::onClick $1 $3
StrCpy $Bool_java 0
nsDialogs::Show
FunctionEnd
Function PgPageLeave
FunctionEnd
Function OnClick_CheckMysql
${IF} $Bool_mysql == 1
IntOp $Bool_mysql $Bool_mysql - 1
StrCpy $1 $Ck_mysql
${ELSE}
IntOp $Bool_mysql $Bool_mysql + 1
StrCpy $1 $Ck_mysql
${EndIf}
FunctionEnd
Function OnClick_CheckJava
${IF} $Bool_java == 1
IntOp $Bool_java $Bool_java - 1
StrCpy $1 $Ck_java
${ELSE}
IntOp $Bool_java $Bool_java + 1
StrCpy $1 $Ck_java
${EndIf}
FunctionEnd
!macro customInstall
${If} $Bool_mysql == 0
${ELSE}
MessageBox MB_OK "001" IDOK
${EndIf}
${If} $Bool_java == 0
MessageBox MB_OK "200" IDOK
${ELSE}
MessageBox MB_OK "201" IDOK
${EndIf}
!macroend
Section "MainSection" SEC01
SectionEnd