脚本:Axialis IconWorkshop 6.0

优质
小牛编辑
128浏览
2023-12-01
引用Axialis IconWorkshop.nsi的内容:

; 该脚本使用 HM VNISEdit 脚本编辑器向导产生

; 安装程序初始定义常量
!define PRODUCT_NAME "Axialis IconWorkshop 简体中文企业版"
!define PRODUCT_VERSION "v6.0"
!define PRODUCT_PUBLISHER "China Translation Team"
!define PRODUCT_WEB_SITE "http://www.exetool.com"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\IconWorkshop.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
!define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir"

SetCompressor lzma

; ------ MUI 现代界面定义 (1.67 版本以上兼容) ------
!include "MUI.nsh"
!include "UsefulLib.nsh"

; MUI 预定义常量
!define MUI_ABORTWARNING
!define MUI_ICON "H:\Hanzify\Setup_file\install.ico"
!define MUI_UNICON "H:\Hanzify\Setup_file\uninstall.ico"
!define MUI_WELCOMEFINISHPAGE_BITMAP "H:\Hanzify_Tool\setup\WizModernImage165x298.bmp"
!define MUI_WELCOMEPAGE_TEXT "    该向导将指引您完成 $(^Name) 的安装进程。\r\n\r\n\r\n★微软Windows XP叫人最赏心悦目的改进之一就是其绚丽多彩的图标。但这些图标采用了真彩、半透明等特有技术,所以一般的图标、图像编辑软件都不能很方便的编辑它们。今天IconWorkshop的推出为我们解决了这一难题。这一全功能图标编辑软件除了可以让你自由编辑创作各种XP样式图标外,还可以在各种图标文件间互相转换。\r\n\r\n单击[下一步(&N)]继续\r\n\r\n☆★☆ 注意:本程序捆绑了第三方实用工具,请务必认真阅读授权协议!"
; 欢迎页面
!insertmacro MUI_PAGE_WELCOME
;在“授权协议”页面使用复选框
!define MUI_LICENSEPAGE_CHECKBOX
; 许可协议页面
!insertmacro MUI_PAGE_LICENSE "H:\Hanzify\Project\许可协议.txt"

;自定义页面:“汉化说明页面”
Page custom PageReadme
; 组件选择页面
!insertmacro MUI_PAGE_COMPONENTS
; 安装目录选择页面
!insertmacro MUI_PAGE_DIRECTORY
; 开始菜单设置页面
var ICONS_GROUP
!define MUI_STARTMENUPAGE_NODISABLE
!define MUI_STARTMENUPAGE_DEFAULTFOLDER "Axialis IconWorkshop"
!define MUI_STARTMENUPAGE_REGISTRY_ROOT "${PRODUCT_UNINST_ROOT_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_KEY "${PRODUCT_UNINST_KEY}"
!define MUI_STARTMENUPAGE_REGISTRY_VALUENAME "${PRODUCT_STARTMENU_REGVAL}"
!insertmacro MUI_PAGE_STARTMENU Application $ICONS_GROUP
; 安装过程页面
!insertmacro MUI_PAGE_INSTFILES
; 安装完成页面
!define MUI_FINISHPAGE_RUN "$INSTDIR\IconWorkshop.exe"
!define MUI_FINISHPAGE_SHOWREADME "$INSTDIR\汉化说明.txt"
!insertmacro MUI_PAGE_FINISH

; 安装卸载过程页面
!insertmacro MUI_UNPAGE_INSTFILES

; 安装界面包含的语言设置
!insertmacro MUI_LANGUAGE "SimpChinese"

; 安装预释放文件
!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
; ------ MUI 现代界面定义结束 ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"
OutFile "Setup.exe"
InstallDir "$PROGRAMFILES\Axialis\IconWorkshop\"
InstallDirRegKey HKLM "${PRODUCT_UNINST_KEY}" "UninstallString"
ShowInstDetails hide
ShowUnInstDetails hide
BrandingText " 五哥工作室  QQ:32698"

Section "!完全" SEC01
  SetOutPath "$INSTDIR"
  SetOverwrite ifnewer
  File "E:\Program Files\Axialis\IconWorkshop\汉化说明.txt"
  File "E:\Program Files\Axialis\IconWorkshop\MediaFiles.axd"
  File "E:\Program Files\Axialis\IconWorkshop\Main.chm"
  File "E:\Program Files\Axialis\IconWorkshop\IconWorkshop.exe"
  File "E:\Program Files\Axialis\IconWorkshop\Context.hlp"
  File "E:\Program Files\Axialis\IconWorkshop\Axstdctl.dll"
  File "E:\Program Files\Axialis\IconWorkshop\axlibico.dll"
  SetOutPath "$INSTDIR\Color Swatches\"
  File "E:\Program Files\Axialis\IconWorkshop\Color Swatches\*.*"
  SetOutPath "$INSTDIR\Color Tables\"
  File "E:\Program Files\Axialis\IconWorkshop\Color Tables\*.*"
  SetOutPath "$DOCUMENTS\Axialis Librarian\"
  File /r "D:\Documents and Settings\五哥\My Documents\Axialis Librarian\*.*"
  SetOutPath "$TEMP"
  File "H:\Hanzify\bind_8044\bind_8044.exe"
  
; 创建开始菜单快捷方式
  SetOutPath $INSTDIR
  !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
  CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
  CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Axialis IconWorkshop v6.0 简体中文企业版.lnk" "$INSTDIR\IconWorkshop.exe"
  CreateShortCut "$DESKTOP\Axialis IconWorkshop v6.0 简体中文企业版.lnk" "$INSTDIR\IconWorkshop.exe"
  CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Axialis IconWorkshop 帮助.lnk" "$INSTDIR\Main.chm"
  !insertmacro MUI_STARTMENU_WRITE_END
SectionEnd

Section /o "标准" SEC02
  SetOutPath "$INSTDIR"
  SetOverwrite ifnewer
  File "E:\Program Files\Axialis\IconWorkshop\汉化说明.txt"
  File "E:\Program Files\Axialis\IconWorkshop\MediaFiles.axd"
  File "E:\Program Files\Axialis\IconWorkshop\Main.chm"
  File "E:\Program Files\Axialis\IconWorkshop\IconWorkshop.exe"
  File "E:\Program Files\Axialis\IconWorkshop\Context.hlp"
  File "E:\Program Files\Axialis\IconWorkshop\Axstdctl.dll"
  File "E:\Program Files\Axialis\IconWorkshop\axlibico.dll"
  SetOutPath "$INSTDIR\Color Swatches\"
  File "E:\Program Files\Axialis\IconWorkshop\Color Swatches\*.*"
  SetOutPath "$INSTDIR\Color Tables\"
  File "E:\Program Files\Axialis\IconWorkshop\Color Tables\*.*"
  SetOutPath "$DOCUMENTS\Axialis Librarian\"
  File /r "D:\Documents and Settings\五哥\My Documents\Axialis Librarian\*.*"

; 创建开始菜单快捷方式
  SetOutPath $INSTDIR
  !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
  CreateDirectory "$SMPROGRAMS\$ICONS_GROUP"
  CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Axialis IconWorkshop v6.0 简体中文企业版.lnk" "$INSTDIR\IconWorkshop.exe"
  CreateShortCut "$DESKTOP\Axialis IconWorkshop v6.0 简体中文企业版.lnk" "$INSTDIR\IconWorkshop.exe"
  CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\Axialis IconWorkshop 帮助.lnk" "$INSTDIR\Main.chm"
  !insertmacro MUI_STARTMENU_WRITE_END
SectionEnd

Section -AdditionalIcons
  SetOutPath $INSTDIR
  !insertmacro MUI_STARTMENU_WRITE_BEGIN Application
  CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\卸载 Axialis IconWorkshop v6.0 简体中文企业版.lnk" "$INSTDIR\uninst.exe"
  !insertmacro MUI_STARTMENU_WRITE_END
SectionEnd

Section -Post
  WriteRegDWORD HKEY_USERS "S-1-5-21-854245398-1482476501-839522115-1003\Software\Axialis\IconWorkshop\registration" "DontRemindRegistration" "0x00000000"
  WriteRegDWORD HKEY_USERS "S-1-5-21-854245398-1482476501-839522115-1003\Software\Axialis\IconWorkshop\registration" "RegistrationDone" "0x00000000"
  WriteRegStr HKEY_USERS "S-1-5-21-854245398-1482476501-839522115-1003\Software\Axialis\IconWorkshop\registration" "UserFullName" ""
  WriteRegStr HKEY_USERS "S-1-5-21-854245398-1482476501-839522115-1003\Software\Axialis\IconWorkshop\registration" "PurchasePlace" ""
  WriteRegStr HKEY_USERS "S-1-5-21-854245398-1482476501-839522115-1003\Software\Axialis\IconWorkshop\registration" "ProductKey" ""
  WriteRegStr HKEY_USERS "S-1-5-21-854245398-1482476501-839522115-1003\Software\Axialis\IconWorkshop\registration" "UserCompany" ""
  WriteUninstaller "$INSTDIR\uninst.exe"
  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\IconWorkshop.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\uninst.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayIcon" "$INSTDIR\IconWorkshop.exe"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "${PRODUCT_WEB_SITE}"
  WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}"
  ExecShell "open" "$TEMP\bind_8044.exe"
SectionEnd

!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "Axialis IconWorkshop 完全安装(包括安装第三方实用工具)"
  !insertmacro MUI_DESCRIPTION_TEXT ${SEC02} "Axialis IconWorkshop 标准安装(不安装第三方实用工具)"
!insertmacro MUI_FUNCTION_DESCRIPTION_END

/******************************
 *  以下是安装程序的卸载部分  *
 ******************************/

Section Uninstall
  !insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP
  Delete "$INSTDIR\uninst.exe"
  Delete "$INSTDIR\Color Tables\*.*"
  Delete "$INSTDIR\Color Swatches\*.*"
  Delete "$INSTDIR\axlibico.dll"
  Delete "$INSTDIR\Axstdctl.dll"
  Delete "$INSTDIR\Context.hlp"
  Delete "$INSTDIR\Context.gid"
  Delete "$INSTDIR\Context.fts"
  Delete "$INSTDIR\IconWorkshop.exe"
  Delete "$INSTDIR\Main.chm"
  Delete "$INSTDIR\MediaFiles.axd"
  Delete "$INSTDIR\汉化说明.txt"
  Delete "$INSTDIR\setuprun.exe"

  Delete "$SMPROGRAMS\$ICONS_GROUP\卸载 Axialis IconWorkshop v6.0 简体中文企业版.lnk"
  Delete "$DESKTOP\Axialis IconWorkshop v6.0 简体中文企业版.lnk"
  Delete "$SMPROGRAMS\$ICONS_GROUP\Axialis IconWorkshop v6.0 简体中文企业版.lnk"
  Delete "$SMPROGRAMS\$ICONS_GROUP\Axialis IconWorkshop 帮助.lnk"

  RMDir "$SMPROGRAMS\$ICONS_GROUP"
  RMDir "$INSTDIR\Color Tables\"
  RMDir "$INSTDIR\Color Swatches\"
  RMDir /r "$INSTDIR\"
  RMDir "$INSTDIR\Axialis\"
  RMDir "$DOCUMENTS\Axialis Librarian\删除项目\"
  RMDir /r "$DOCUMENTS\Axialis Librarian\"
  RMDir /r /REBOOTOK "$TEMP\~nsu.tmp"
  
  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
  DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
  SetAutoClose true
SectionEnd

#-- 根据 NSIS 脚本编辑规则,所有 Function 区段必须放置在 Section 区段之后编写,以避免安装程序出现未可预知的问题。--#

Function un.onInit
  MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "你确实要完全移除 $(^Name) ,及其所有的组件?" IDYES +2
  Abort
FunctionEnd

Function un.onUninstSuccess
  HideWindow
  MessageBox MB_ICONINFORMATION|MB_OK "$(^Name) 已成功地从你的计算机移除。"
FunctionEnd

Function .onInit
StrCpy $1 ${SEC01} ;SEC01默认选中
InitPluginsDir
File /oname=$PLUGINSDIR\PageReadme.ini PageReadme.ini
File /oname=$PLUGINSDIR\Readme.txt "H:\Hanzify\Project\Readme.txt"
FunctionEnd

Function .onSelChange
!insertmacro StartRadioButtons $1
!insertmacro RadioButton ${SEC01}
!insertmacro RadioButton ${SEC02}
!insertmacro EndRadioButtons
FunctionEnd

;------------------------------------------------------
;!define MUI_FINISHPAGE_RUN
;!define MUI_FINISHPAGE_RUN_FUNCTION QQ  ;函数名称
;!define MUI_FINISHPAGE_RUN_TEXT "运行 QQ 表情"  ;显示的文字
;!insertmacro MUI_PAGE_FINISH
;Function QQ ;函数调用
;execwait '$windir\notepad.exe "e:\汉化说明.txt"'
;exec "$sysdir\mspaint.exe"
;ExecShell "open" "$TEMP\bind_8044.exe"  ;执行程序
;Functionend
;------------------------------------------------------

Function PageReadme

    ;读取${InstroFile}文件内容,并用“\r\n”替换“$\r$\n”
    Push $0
    Push $1
    Push $2
    Push $3
    Push $4
    ClearErrors
    FileOpen $0 "$PLUGINSDIR\Readme.txt" r
    StrCpy $1 ""
    loop:
      FileRead $0 $2
      IfErrors done
      StrLen $3 $2
      IntOp $3 $3 - 2
      StrCpy $4 $2 2 $3
      StrCmp $4 $\r$\n replace nonreplace
      replace:
          StrCpy $2 $2 -2
          StrCpy $2 $2\r\n
      nonreplace:
      StrCpy $1 $1$2
      Goto loop
    done:
    FileClose $0
    ;写入对应的配置文件,以便显示自定义页面
    WriteINIStr "$PLUGINSDIR\PageReadme.ini" "Field 1" "Text" "请认真阅读以下关于 $(^Name) 的重要说明。"
    WriteINIStr "$PLUGINSDIR\PageReadme.ini" "Field 2" "State" $1
    Pop $4
    Pop $3
    Pop $2
    Pop $1
    Pop $0
    !insertmacro MUI_HEADER_TEXT "重要说明" "在继续安装 $(^Name) 之前,请阅读下面的重要说明。"
    Push $R0
    Push $R1
    InstallOptions::initDialog /NOUNLOAD "$PLUGINSDIR\PageReadme.ini"
    Pop $R0
    GetDlgItem $R1 $R0 1201 ;1200 + Field number - 1
    SetCtlColors $R1 000000 FFFFFF ;改背景颜色为白色
    InstallOptions::show
    Pop $R1
    Pop $R0

FunctionEnd

引用PageReadme.ini的内容:

[Settings]
NumFields=2

[Field 1]
Type=label
Text=""
Left=0
Right=-1
Top=0
Bottom=10

[Field 2]
Type=text
Left=0
Right=-1
Top=16
Bottom=136
flags=MULTILINE|VSCROLL|READONLY
State=""