最新消息:

桌面日历秀NSIS脚本供大家参考学习

nsis 永恒心锁 1840浏览 0评论
; 安装程序初始定义常量

!define PRODUCT_NAME "桌面日历秀"

!define PRODUCT_VERSION "3.1.0 免费版"

!define PRODUCT_UNINST_KEY "SoftwareMicrosoftWindowsCurrentVersionUninstall${PRODUCT_NAME}"

!define PRODUCT_UNINST_ROOT_KEY "HKLM"

!define /date VER_BUILD "%Y.%m.%d"

SetCompressor lzma

RequestExecutionLevel admin

; ------ MUI 现代界面定义 (1.67 版本以上兼容) ------

!include "MUI.nsh"

; MUI 预定义常量

!define MUI_ABORTWARNING

!define MUI_HEADERIMAGE

!define MUI_HEADERIMAGE_BITMAP "modern-header.bmp"

!define MUI_ICON "ico.ico"

!define MUI_UNICON "unico.ico"

!define MUI_WELCOMEFINISHPAGE_BITMAP "modern-wizard.bmp"

!define MUI_WELCOMEPAGE_TITLE "rn  桌面日历秀 3.1.0 免费版"

!define MUI_WELCOMEPAGE_TEXT "rn 桌面日历秀是一款优秀的桌面日历和个人信息管理软件。rnrn 此版本已经剔除了原安装包中的haozip和百度搜霸,安装过程中可以自动进行软件注册而无任何功能或时间限制,所以命名为“免费版”。rnrn 桌面日历秀原始文件收集于网络,您使用该软件时所享受到的主要功能,皆为原始作者的开发成果。使用此软件是您的自由选择,永恒心锁(www.yhxs3344.net)并不对可能由此给您带来的任何损失负责。如果您认为该软件具有实用价值,请从正式渠道获得授权许可。rnrn $_CLICK"

!define MUI_FINISHPAGE_RUN_TEXT "运行桌面日历秀"

; 欢迎页面

!insertmacro MUI_PAGE_WELCOME

; 许可协议页面

!define MUI_LICENSEPAGE_CHECKBOX

!insertmacro MUI_PAGE_LICENSE "license.rtf"

; 组件选择页面

!insertmacro MUI_PAGE_COMPONENTS

; 安装目录选择页面

!define MUI_PAGE_CUSTOMFUNCTION_show Pageshow

!insertmacro MUI_PAGE_DIRECTORY

; 安装过程页面

!insertmacro MUI_PAGE_INSTFILES

; 安装完成页面

!define MUI_FINISHPAGE_RUN "$INSTDIRXDeskCal.exe"

!insertmacro MUI_PAGE_FINISH

; 安装卸载过程页面

!insertmacro MUI_UNPAGE_INSTFILES

; 安装界面包含的语言设置

!insertmacro MUI_LANGUAGE "SimpChinese"

;文件版本声明

VIProductVersion "3.1.0.1225"

VIAddVersionKey /LANG=2052 "ProductName" "桌面日历秀免费版"

VIAddVersionKey /LANG=2052 "Comments" "免费使用,不限分发。"

VIAddVersionKey /LANG=2052 "CompanyName" "www.yhxs3344.net"

VIAddVersionKey /LANG=2052 "LegalTrademarks" "yhxs3344"

VIAddVersionKey /LANG=2052 "LegalCopyright" "永恒心锁"

VIAddVersionKey /LANG=2052 "FileDescription" "桌面日历秀免费版"

VIAddVersionKey /LANG=2052 "FileVersion" "3.1.0.1225"

; 安装预释放文件

!insertmacro MUI_RESERVEFILE_INSTALLOPTIONS

; ------ MUI 现代界面定义结束 ------

Name "${PRODUCT_NAME} ${PRODUCT_VERSION}"

OutFile "XDeskCal_Free.exe"

InstallDir "D:Program FilesXDeskCal"

;读取注册中的键值,如果没有,就按默认路径。

InstallDirRegKey HKCU "SoftwareXDeskCal" ""

ShowInstDetails show

ShowUnInstDetails show

ShowInstDetails hide ;该项默认为show,hide表示不显示安装信息,点击显示按钮后显示。

ShowUnInstDetails hide ;该项同上,卸载过程

BrandingText "永恒心锁www.yhxs3344.net- 编译日期${VER_BUILD}"

Section "主程序" SEC01

SectionIn RO

SetOutPath "$INSTDIR"

SetOverwrite ifnewer

File /r "桌面日历秀*.*"

SectionEnd

SectionGroup "快捷方式" SEC02

Section "开始菜单" SEC0201

SectionIn 1

CreateDirectory "$SMPROGRAMS桌面日历秀"

CreateShortCut "$SMPROGRAMS桌面日历秀桌面日历秀.lnk" "$INSTDIRXDeskCal.exe"

CreateShortCut "$SMPROGRAMS桌面日历秀卸载日历秀.lnk" "$INSTDIR卸载程序.exe"

SectionEnd

Section "桌面" SEC0202

SectionIn 1

CreateShortCut "$DESKTOP桌面日历秀.lnk" "$INSTDIRXDeskCal.exe"

SectionEnd

SectionGroupEnd

Section "自动运行" SEC03

WriteRegStr HKLM "SOFTWAREMicrosoftWindowsCurrentVersionRun" "XDeskCal" "$INSTDIRXDeskCal.exe"
101
SectionEnd

Section -Post

WriteUninstaller "$INSTDIR卸载程序.exe"

;把用户选择的安装路径写入注册表中

WriteRegStr HKCU "SoftwareXDeskCal" "" $INSTDIR

WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)"

WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIRuninst.exe"

WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}"

SectionEnd

; 区段组件描述

!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN

!insertmacro MUI_DESCRIPTION_TEXT ${SEC01} "桌面日历秀的主程序,必选!"

!insertmacro MUI_DESCRIPTION_TEXT ${SEC02} "快捷方式可选安装。"

!insertmacro MUI_DESCRIPTION_TEXT ${SEC0201} "开始菜单快捷方式。"

!insertmacro MUI_DESCRIPTION_TEXT ${SEC0202} "桌面快捷方式。"

!insertmacro MUI_DESCRIPTION_TEXT ${SEC03} "选择操作系统启动时是否自动运行桌面日历秀。"

!insertmacro MUI_FUNCTION_DESCRIPTION_END

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

Section Uninstall

Delete "$INSTDIRconfig.ini"

Delete "$INSTDIRGdiPlus.dll"

Delete "$INSTDIRUpdate.exe"

Delete "$INSTDIRupdate.URS"

Delete "$INSTDIRUpdateLang.ini"

Delete "$INSTDIRXDeskCal.exe"

Delete "$INSTDIR卸载程序.exe"

Delete "$SMPROGRAMS桌面日历秀卸载日历秀.lnk"

Delete "$SMPROGRAMS桌面日历秀桌面日历秀.lnk"

Delete "$SMSTARTUP桌面日历秀.lnk"

Delete "$DESKTOP桌面日历秀.lnk"

RMDir "$SMPROGRAMS桌面日历秀"

RMDir /r "$INSTDIRRes"

RMDir /r "$INSTDIRPluginSkins"

RMDir /r "$INSTDIRmainskins"

RMDir /r "$INSTDIRicon"

RMDir "$INSTDIRDataBackup"

RMDir "$INSTDIRData"

RMDir "$INSTDIR"

DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}"

;卸载注册表中安装路径的键值

DeleteRegKey /ifempty HKCU "SoftwareXDeskCal"

;卸载注册表中自动运行的键值

DeleteRegValue HKLM "SOFTWAREMicrosoftWindowsCurrentVersionRun" "XDeskCal"

SetAutoClose true

SectionEnd

Function Pageshow

ReadRegStr $0 HKCU "SoftwareXDeskCal" ""

${If} $0 == ""

${Else}

;禁用浏览按钮

FindWindow $0 "#32770" "" $HWNDPARENT

GetDlgItem $0 $0 1001

EnableWindow $0 0

;禁用编辑的目录

FindWindow $0 "#32770" "" $HWNDPARENT

GetDlgItem $0 $0 1019

EnableWindow $0 0

FindWindow $0 "#32770" "" $HWNDPARENT

GetDlgItem $0 $0 1006

SendMessage $0 ${WM_SETTEXT} 0 "STR:您已经安装过 ${PRODUCT_NAME} ,现在进行的覆盖安装不能更改安装目录,如果您需要更改安装目录,请先卸载已经安装的版本之后再运行此安装程序!"

${EndIf}

FunctionEnd

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
永恒心锁,版权所有丨如未注明,均为转载丨本网站采用BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » 桌面日历秀NSIS脚本供大家参考学习

您必须 登录 才能发表评论!