脚本:CorelDRAW X4 14.0.0.653 精简版
优质
小牛编辑
135浏览
2023-12-01
;包含插件位置 !addplugindir ".\" !AddIncludeDir ".\" ;保存HKCU的位置 var HKCUPATH /******************************程序信息*********************************/ !define PRODUCT_NAME "CorelDRAW X4 14.0.0.653 精简版" !define PRODUCT_VERSION "" !define PRODUCT_PUBLISHER "音乐杀手" ;压缩方式 SetCompressor lzma ;包含的头文件 !include "MUI.nsh" !include "UsefulLib.nsh" ;加入逻辑库 支持条件判断 循环语句 注意 if 之类语句必须要写成 ${if} !include "LogicLib.nsh" ;水纹效果插件位置 ReserveFile "F:\bak\2d\CorelDRAW X4 精简版\waterctrl.dll" ;加入水纹效果 !define MUI_PAGE_CUSTOMFUNCTION_Pre pre !define MUI_PAGE_CUSTOMFUNCTION_LEAVE leave /******************************安装界面设置*********************************/ ;描述框在下面的小型安装界面 !define MUI_COMPONENTSPAGE_SMALLDESC /******************************相关图标的位置*********************************/ !define MUI_ABORTWARNING !define MUI_ICON "F:\bak\2d\CorelDRAW X4 精简版\安装图标\CD48.ICO" !define MUI_UNICON "F:\bak\2d\CorelDRAW X4 精简版\安装图标\CD48.ICO" !define MUI_WELCOMEFINISHPAGE_BITMAP "F:\bak\2d\CorelDRAW X4 精简版\安装图标\LOGOLEFT.bmp" ;加入头图片 !define MUI_HEADERIMAGE ;设置要显示的图片,默认为左边的图片, 右边的图片名为 MYLOGOTOPRIGHT.bmp !define MUI_HEADERIMAGE_BITMAP "F:\bak\2d\CorelDRAW X4 精简版\安装图标\LOGOTOPRIGHT.bmp" ;图标放右边 !define MUI_HEADERIMAGE_RIGHT ;欢迎页面加上生成日期 !define MUI_WELCOMEPAGE_TITLE "CorelDRAW X4 精简版安装向导" /******************************页面显示顺序(新式界面)*********************************/ ; 欢迎页面 !insertmacro MUI_PAGE_WELCOME ;安装目录选择 !insertmacro MUI_PAGE_DIRECTORY ;组件选择 !insertmacro MUI_PAGE_COMPONENTS ; 安装过程页面 !insertmacro MUI_PAGE_INSTFILES ;完成页面显示 运行程序 ; !define MUI_FINISHPAGE_RUN_TEXT "运行CorelDRAW X4 精简版" ;运行程序的位置 ; !define MUI_FINISHPAGE_RUN "$INSTDIR\Programs\CorelDRW.exe" ;加入水纹效果 !define MUI_PAGE_CUSTOMFUNCTION_Pre pre !define MUI_PAGE_CUSTOMFUNCTION_LEAVE leave ;完成页面 !insertmacro MUI_PAGE_FINISH ; 安装卸载过程页面 !insertmacro MUI_UNPAGE_INSTFILES ;安装程序的语言 !insertmacro MUI_LANGUAGE "SimpChinese" ;Reserve files ; !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS /******************************页面通用属性设置(新式界面)*********************************/ Name "${PRODUCT_NAME} ${PRODUCT_VERSION}" OutFile "CorelDRAW X4 精简版.exe" BrandingText "赢政天下----音乐杀手制作" ;显示详细安装信息 ShowInstDetails Show InstallDir "$PROGRAMFILES\CorelDRAW X4" ; CheckBitmap F:\BAK\安装\NSIS\图标\Check.bmp ; 激活安装日志记录,该日志文件将会作为卸载文件的依据(注意,本区段必须放置在所有区段之前) Section "-LogSetOn" LogSet on SectionEnd /******************************安装组件*********************************/ Section "主程序" ;安装类型为只读 SectionIn RO ;覆盖方式 SetOverwrite try SetOutPath "$INSTDIR" File /r "F:\bak\2d\CorelDRAW X4 精简版\CorelDRAW X4\*.*" SetOutPath "$PROFILE\" File /r "F:\bak\2D\CorelDRAW X4 精简版\工作区\*.*" SetOutPath "$COMMONFILES\" File /r "F:\bak\2D\CorelDRAW X4 精简版\Common Files\*.*" SectionEnd Section "-创建快捷方式" CreateShortCut "$DESKTOP\CorelDRAW X4 精简版.lnk" "$INSTDIR\Programs\CorelDRW.exe" CreateDirectory "$SMPROGRAMS\CorelDRAW X4 精简版" CreateShortCut "$SMPROGRAMS\CorelDRAW X4 精简版\CorelDRAW X4 精简版.lnk" "$INSTDIR\Programs\CorelDRW.exe" CreateShortCut "$SMPROGRAMS\CorelDRAW X4 精简版\CorelDraw 9 文件转换器.lnk" "$INSTDIR\Programs\CoreDraw9.exe" CreateShortCut "$SMPROGRAMS\CorelDRAW X4 精简版\双面打印向导.lnk" "$INSTDIR\Programs\PrintWiz.exe" CreateShortCut "$SMPROGRAMS\CorelDRAW X4 精简版\条形码制作工具.lnk" "$INSTDIR\Programs\BarCode.exe" CreateShortCut "$SMPROGRAMS\CorelDRAW X4 精简版\SB Profiler.lnk" "$INSTDIR\Programs\CSBProf.exe" ; CreateShortCut "$SMPROGRAMS\CorelDRAW X4 精简版\注册机.lnk" "$INSTDIR\Programs\keygen.exe" CreateShortCut "$SMPROGRAMS\CorelDRAW X4 精简版\卸载.lnk" "$INSTDIR\uninst.exe" SectionEnd Section "以缩略图方式显示CDR文件" ReadRegStr $1 HKLM "SOFTWARE\Classes\.CDR" "" WriteRegStr HKCR ".cdr" "" "$1" WriteRegStr HKCR ".cdr\ShellNew" "NullFile" "" WriteRegStr HKCR ".cdr\ShellNew" "" "$1" WriteRegStr HKCR ".cdx\ShellNew" "" "$1" WriteRegStr HKCR ".cdx\ShellNew" "Default Backup" "aspfile" WriteRegStr HKCR ".CMX\ShellNew" "" "$1" WriteRegStr HKCR ".CMX\ShellNew" "Default Backup" "$1" WriteRegStr HKCR ".cpt\ShellNew" "" "$1" WriteRegStr HKCR ".cpt\ShellNew" "Default Backup" "$1" WriteRegStr HKCR ".CPX\ShellNew" "" "$1" WriteRegStr HKCR ".CSL\ShellNew" "" "$1" WriteRegStr HKCR ".DRW\ShellNew" "" "$1" WriteRegStr HKCR ".DS4\ShellNew" "" "$1" WriteRegStr HKCR ".DSF\ShellNew" "" "$1" WriteRegStr HKCR ".PRN\ShellNew" "" "$1" WriteRegStr HKCR ".WP\ShellNew" "" "$1" WriteRegStr HKCR ".WP4\ShellNew" "" "$1" WriteRegStr HKCR ".WP5\ShellNew" "" "$1" WriteRegStr HKCR ".WP6\ShellNew" "" "$1" WriteRegStr HKCR ".wpd\ShellNew" "" "$1" WriteRegStr HKCR ".wpg\ShellNew" "" "$1" WriteRegStr HKCR ".WQ1\ShellNew" "" "$1" WriteRegStr HKCR ".WSD\ShellNew" "" "$1" WriteRegStr HKCR "$1\ShellEx\IconHandler" "" "{BF735767-E6DA-11cf-AB9B-00C0F00683EB}" WriteRegStr HKCR "CLSID\{BF735767-E6DA-11cf-AB9B-00C0F00683EB}" "" "Corel CDR Icon Handler" WriteRegStr HKCR "CLSID\{BF735765-E6DA-11cf-AB9B-00C0F00683EB}\InProcServer32" "" "$INSTDIR\PROGRAMS\CdrIco.DLL" WriteRegStr HKCR "CLSID\{BF735767-E6DA-11cf-AB9B-00C0F00683EB}\InProcServer32" "ThreadingModel" "Apartment" WriteRegStr HKCR "CLSID\{BF735767-E6DA-11cf-AB9B-00C0F00683EB}\ShellEx\IconHandler" "" "{BF735767-E6DA-11cf-AB9B-00C0F00683EB}" SectionEnd SectionGroup /e "X4必要的系统程序" Section "MSXML6.0" SetOverwrite on SetOutPath "$INSTDIR\" File /r "F:\bak\2d\CorelDRAW X4 精简版\msxml6.msi" Execwait 'msiexec /qn /i "$INSTDIR\msxml6.msi"' SectionEnd Section "VC++ 2005运行库(x86)" SetOverwrite on SetOutPath "$INSTDIR\VC++ 2005\" File /r "F:\bak\2d\CorelDRAW X4 精简版\VC++ 2005\*.*" Execwait 'msiexec /qn /i "$INSTDIR\VC++ 2005\VC++ 2005.msi"' $0 ${IF} $0 != 0 Messagebox MB_YESNO|MB_ICONSTOP "VC++ 2005运行库安装失败 要手动安装VC++ 2005.msi么?" IDYES VCtrue IDNO VCfalse VCtrue: ExecShell "open" "$INSTDIR\VC++ 2005\" goto done VCfalse: done: ${EndIF} SectionEnd SectionGroupEnd /****************************** * 以下是安装程序的卸载部分 * ******************************/ Section -Post WriteUninstaller "$INSTDIR\uninst.exe" SectionEnd ; 根据安装日志卸载文件的调用宏 !macro DelFileByLog LogFile ifFileExists `${LogFile}` 0 +4 Push `${LogFile}` Call un.DelFileByLog Delete `${LogFile}` !macroend Section Uninstall ; 调用宏只根据安装日志卸载安装程序自己安装过的文件 !insertmacro DelFileByLog "$INSTDIR\install.log" ; 清除安装程序创建的且在卸载时可能为空的子目录,对于递归添加的文件目录,请由最内层的子目录开始清除(注意,不要带 /r 参数,否则会失去 DelFileByLog 的意义) RMDir "$SMPROGRAMS\My application" RMDir /r "$INSTDIR" SetAutoClose true SectionEnd #-- 根据 NSIS 脚本编辑规则,所有 Function 区段必须放置在 Section 区段之后编写,以避免安装程序出现未可预知的问题。--# /******************************函数区*********************************/ Function .onInit ;防止多个安装程序运行 System::Call 'kernel32::CreateMutexA(i 0, i 0, t "CorelDRAW X4") i .r1 ?e' Pop $R0 StrCmp $R0 0 +3 MessageBox MB_OK|MB_ICONEXCLAMATION "安装程序已经在运行。" Abort ;初始化水纹效果 InitPluginsDir SetOutPath $PLUGINSDIR ;水纹效果插件位置 File "F:\bak\2d\CorelDRAW X4 精简版\waterctrl.dll" SetRebootFlag true FunctionEnd /*************************************水纹效果 函数*************************************/ Function Pre ;设置水纹范围的大小 0,0,55,0x2010 55为高度 System::Call 'user32::LoadImage(i,t,i,i,i,i,) i (0,"$PLUGINSDIR\modern-wizard.bmp",0,0,0,0x2010) .s' Pop $R0 ;设置水纹效果的位置 350,0,$R0,10,10 350水平位置 垂直位置5 水波大小长10 宽10 System::Call '$PLUGINSDIR\waterctrl::enablewater(i,i,i,i,i,i) i ($HWNDPARENT,0,0,$R0,3,50)' System::Call '$PLUGINSDIR\waterctrl::setwaterparent(i $HWNDPARENT)' System::Call '$PLUGINSDIR\waterctrl::flattenwater()' ;设置水纹 50为初始水纹的水平位置 180为垂直位置 10为振幅大小 1000为强度 System::Call '$PLUGINSDIR\waterctrl::waterblob(i,i,i,i) i (50,180,10,1000)' FunctionEnd Function leave System::Call '$PLUGINSDIR\waterctrl::disablewater()' FunctionEnd /*************************************水纹效果 函数*************************************/ Function .onGUIEnd ;释放水纹效果 SetPluginUnload manual waterctrl::disablewater System::Free 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 ; 以下是卸载程序通过安装日志卸载文件的专用函数,请不要随意修改 Function un.DelFileByLog Exch $R0 Push $R1 Push $R2 Push $R3 FileOpen $R0 $R0 r ${Do} FileRead $R0 $R1 ${IfThen} $R1 == `` ${|} ${ExitDo} ${|} StrCpy $R1 $R1 -2 StrCpy $R2 $R1 11 StrCpy $R3 $R1 20 ${If} $R2 == "File: wrote" ${OrIf} $R2 == "File: skipp" ${OrIf} $R3 == "CreateShortCut: out:" ${OrIf} $R3 == "created uninstaller:" Push $R1 Push `"` Call un.DelFileByLog.StrLoc Pop $R2 ${If} $R2 != "" IntOp $R2 $R2 + 1 StrCpy $R3 $R1 "" $R2 Push $R3 Push `"` Call un.DelFileByLog.StrLoc Pop $R2 ${If} $R2 != "" StrCpy $R3 $R3 $R2 Delete /REBOOTOK $R3 ${EndIf} ${EndIf} ${EndIf} StrCpy $R2 $R1 7 ${If} $R2 == "Rename:" Push $R1 Push "->" Call un.DelFileByLog.StrLoc Pop $R2 ${If} $R2 != "" IntOp $R2 $R2 + 2 StrCpy $R3 $R1 "" $R2 Delete /REBOOTOK $R3 ${EndIf} ${EndIf} ${Loop} FileClose $R0 Pop $R3 Pop $R2 Pop $R1 Pop $R0 FunctionEnd Function un.DelFileByLog.StrLoc Exch $R0 Exch Exch $R1 Push $R2 Push $R3 Push $R4 Push $R5 StrLen $R2 $R0 StrLen $R3 $R1 StrCpy $R4 0 ${Do} StrCpy $R5 $R1 $R2 $R4 ${If} $R5 == $R0 ${OrIf} $R4 = $R3 ${ExitDo} ${EndIf} IntOp $R4 $R4 + 1 ${Loop} ${If} $R4 = $R3 StrCpy $R0 "" ${Else} StrCpy $R0 $R4 ${EndIf} Pop $R5 Pop $R4 Pop $R3 Pop $R2 Pop $R1 Exch $R0 FunctionEnd