脚本:快车(FlashGet)3.1.0.1052 去广告版

优质
小牛编辑
136浏览
2023-12-01
引用FlashGet 3.nsi的内容:

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

; 安装程序初始定义常量
!define PRODUCT_NAME "快车(FlashGet)"
!define PRODUCT_VERSION "V3.1.0.1052 去广告版 "
!define PRODUCT_PUBLISHER "九天"
!define PRODUCT_WEB_SITE "http://www.www.com/"
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\Flashget3.exe"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"

;更改汉化作者
BrandingText "麒麟软件站,精品软件,无毒,无插件"
SetCompressor /SOLID lzma
SetCompressorDictSize 16

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

; MUI 预定义常量
!define MUI_ABORTWARNING
!define MUI_ICON "FlashGet.ico"
!define MUI_UNICON "Funinst.ico"

;更改安装完成后显示运行名字
!define MUI_FINISHPAGE_RUN_TEXT "运行 快车(FlashGet)去广告版"

!define MUI_CUSTOMFUNCTION_GUIINIT MyGUIInit

; 欢迎页面
!insertmacro MUI_PAGE_WELCOME
DirText "安装程序将安装 $(^NameDA) 在下列文件夹。要安装到不同文件夹,单击 [浏览(B)] 并选择其他的文件夹。 $_CLICK"
; 组件选择页面
!insertmacro MUI_PAGE_COMPONENTS
; 安装目录选择页面
!insertmacro MUI_PAGE_DIRECTORY
; 安装过程页面
!insertmacro MUI_PAGE_INSTFILES
; 安装完成页面
!define MUI_FINISHPAGE_RUN "$INSTDIR\FlashGet 3\Flashget3.exe"
!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\FlashGet Network"
InstallDirRegKey HKLM "${PRODUCT_UNINST_KEY}" "UninstallString"
ShowInstDetails show
ShowUnInstDetails show

Section "主程序(必选)" SEC01
  SectionIn RO
  SetOutPath "$INSTDIR"
  nsExec::ExecToLog "taskkill /F /T /IM Flashget3.exe"
  SetOverwrite ifnewer
  File /r "..\My Documents\Administrator\Desktop\FlashGet Network\*.*"
  SetOutPath "$INSTDIR\FlashGet 3"
  WriteRegStr   HKLM "SOFTWARE\FlashGet Network\BHOHelper\10" "Exe" "$INSTDIR\FlashGet 3\flashget3.exe"
  WriteRegStr   HKLM "SOFTWARE\FlashGet Network\BHOHelper\10" "Version" "3.1.0.1052"
  WriteRegStr   HKCU "Software\Microsoft\Internet Explorer\MenuExt\使用快车3下载" "" "$INSTDIR\FlashGet 3\GetUrl.htm"
  WriteRegDWORD HKCU "Software\Microsoft\Internet Explorer\MenuExt\使用快车3下载" "contexts" 34
  WriteRegStr   HKCU "Software\Microsoft\Internet Explorer\MenuExt\使用快车3下载全部链接" "" "$INSTDIR\FlashGet 3\GetAllUrl.htm"
  WriteRegDWORD HKCU "Software\Microsoft\Internet Explorer\MenuExt\使用快车3下载全部链接" "contexts" 243
  File "..\My Documents\Administrator\Desktop\FlashGet Network\FlashGet 3\Flashget3.exe"
  CreateDirectory "$SMPROGRAMS\快车(FlashGet)"
  CreateShortCut "$SMPROGRAMS\快车(FlashGet)\快车(FlashGet).lnk" "$INSTDIR\FlashGet 3\Flashget3.exe"
  CreateShortCut "$DESKTOP\快车(FlashGet).lnk" "$INSTDIR\FlashGet 3\Flashget3.exe"
SectionEnd


Section -AdditionalIcons
  SetOutPath $INSTDIR
  WriteIniStr "$INSTDIR\web.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}"
  CreateShortCut "$SMPROGRAMS\快车(FlashGet)\Uninstall.lnk" "$INSTDIR\uninst.exe"
SectionEnd

Section -Post
  WriteUninstaller "$INSTDIR\uninst.exe"
  WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\FlashGet 3\Flashget3.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\FlashGet 3\Flashget3.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}"
SectionEnd

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

; 区段组件描述
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  !insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "快车主程序,必须选择,否则程序将无法运行."
!insertmacro MUI_FUNCTION_DESCRIPTION_END

Section "-Regdll" SEC
RegDLL "$INSTDIR\FlashGet 3\FlashGetBHO3.dll"
SectionEnd
/******************************
 *  以下是安装程序的卸载部分  *
 ******************************/

Section Uninstall
  nsExec::ExecToLog "taskkill /F /T /IM Flashget3.exe"
  Delete "$INSTDIR\uninst.exe"
  Delete "$INSTDIR\FlashGet 3\Flashget3.exe"

  Delete "$SMPROGRAMS\快车(FlashGet)\Uninstall.lnk"
  Delete "$DESKTOP\快车(FlashGet).lnk"
  Delete "$SMPROGRAMS\快车(FlashGet)\快车(FlashGet).lnk"

  RMDir "$SMPROGRAMS\快车(FlashGet)"
  RMDir "$INSTDIR\FlashGet 3"

  RMDir /r "$INSTDIR\FlashGet 3"

  RMDir "$INSTDIR"

  DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"
  DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}"
  DeleteRegKey HKLM "SOFTWARE\FlashGet Network"
  DeleteRegKey HKCU "Software\Microsoft\Internet Explorer\MenuExt\使用快车3下载"
  DeleteRegKey HKCU "Software\Microsoft\Internet Explorer\MenuExt\使用快车3下载全部链接"
  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