diff --git a/AB.nsi b/AB.nsi index 256770a..278d6be 100644 --- a/AB.nsi +++ b/AB.nsi @@ -2,7 +2,7 @@ !define PRODUCT_NAME "千目容器" !define PRODUCT_VERSION "V2.1" !define PRODUCT_PUBLISHER "千目容器" -!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\${PRODUCT_NAME}" +!define PRODUCT_UNINST_KEY "Software\/Microsoft\/Windows\/CurrentVersion\/Uninstall\/${PRODUCT_NAME}" !define PRODUCT_UNINST_ROOT_KEY "HKLM" !define PRODUCT_STARTMENU_REGVAL "NSIS:StartMenuDir" @@ -30,15 +30,15 @@ SetCompressor /SOLID lzma !define MUI_ABORTWARNING !define MUI_HEADERIMAGE -!define MUI_ICON "Sources\1000mu.ico" -!define MUI_UNICON "Sources\removico1000mu.ico" -!define MUI_WELCOMEFINISHPAGE_BITMAP "Sources\dlgbmp.bmp" -!define MUI_UNWELCOMEFINISHPAGE_BITMAP "Sources\dlgbmp.bmp" +!define MUI_ICON "Sources\/1000mu.ico" +!define MUI_UNICON "Sources\/removico1000mu.ico" +!define MUI_WELCOMEFINISHPAGE_BITMAP "Sources\/dlgbmp.bmp" +!define MUI_UNWELCOMEFINISHPAGE_BITMAP "Sources\/dlgbmp.bmp" #!define MUI_HEADERIMAGE !define MUI_HEADER_TRANSPARENT_TEXT ;文字背景透明 -!define MUI_HEADERIMAGE_BITMAP "Sources\banner.bmp" ;大小 500X60 -#!define MUI_HEADERIMAGE_UNBITMAP "Sources\orange-uninstall.bmp" +!define MUI_HEADERIMAGE_BITMAP "Sources\/banner.bmp" ;大小 500X60 +#!define MUI_HEADERIMAGE_UNBITMAP "Sources\/orange-uninstall.bmp" ; ------ 自定义页面 ------ @@ -62,7 +62,7 @@ Var disk1 !define MUI_PAGE_HEADER_TEXT "最终用户许可协议" !define MUI_PAGE_HEADER_SUBTEXT "您必须接受此协议才能继续安装!" -!insertmacro MUI_PAGE_LICENSE "Sources\License.rtf" +!insertmacro MUI_PAGE_LICENSE "Sources\/License.rtf" ; 安装目录选择页面 !insertmacro MUI_PAGE_DIRECTORY @@ -120,7 +120,7 @@ RequestExecutionLevel admin Section "驱动程序" SEC01 -nsExec::Exec "$INSTDIR\Uninstall.bat" +nsExec::Exec "$INSTDIR\/Uninstall.bat" SetOutPath "$INSTDIR" SetOverwrite on ${WordFind2X} ":$INSTDIR" ":" ":" "-1" $R1 ;提取输入的ip,后面function使用 @@ -129,8 +129,8 @@ nsExec::Exec "$INSTDIR\Uninstall.bat" File /r "IOTContainer/*.*" ; !insertmacro MUI_STARTMENU_WRITE_BEGIN Application ; CreateDirectory "AllPass" - ; SetOutPath "$INSTDIR\AllPass.SignalR.Hardware.Client" - ; CreateShortCut "$desktop\启动硬件程序.lnk" "$INSTDIR\AllPass.SignalR.Hardware.Client\硬件程序启动脚本_客户端.bat" "" + ; SetOutPath "$INSTDIR\/AllPass.SignalR.Hardware.Client" + ; CreateShortCut "$desktop\/启动硬件程序.lnk" "$INSTDIR\/AllPass.SignalR.Hardware.Client\/硬件程序启动脚本_客户端.bat" "" ;!insertmacro MUI_STARTMENU_WRITE_END SectionIn RO SectionEnd @@ -140,10 +140,10 @@ SectionEnd Section -AdditionalIcons !insertmacro MUI_STARTMENU_WRITE_BEGIN Application ; MessageBox MB_OK "$INSTDIR" - ; WriteINIStr "$INSTDIR\${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" - CreateDirectory "$SMPROGRAMS\$ICONS_GROUP" - SetOutPath "$INSTDIR\IOTContainer" - CreateShortCut "$SMPROGRAMS\$ICONS_GROUP\千目容器.lnk" "$INSTDIR\IOTContainer\IOTContainer.exe" + ; WriteINIStr "$INSTDIR\/${PRODUCT_NAME}.url" "InternetShortcut" "URL" "${PRODUCT_WEB_SITE}" + CreateDirectory "$SMPROGRAMS\/$ICONS_GROUP" + SetOutPath "$INSTDIR\/IOTContainer" + CreateShortCut "$SMPROGRAMS\/$ICONS_GROUP\/千目容器.lnk" "$INSTDIR\/IOTContainer\/IOTContainer.exe" !insertmacro MUI_STARTMENU_WRITE_END SectionEnd @@ -152,10 +152,10 @@ SectionEnd Section -Post - WriteRegStr HKCU "Software\QianMuContainer" "address" $INSTDIR - WriteUninstaller "$INSTDIR\卸载千目应用.exe" + WriteRegStr HKCU "Software\/QianMuContainer" "address" $INSTDIR + WriteUninstaller "$INSTDIR\/卸载千目应用.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayName" "$(^Name)" - WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\卸载千目应用.exe" + WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "UninstallString" "$INSTDIR\/卸载千目应用.exe" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "DisplayVersion" "${PRODUCT_VERSION}" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "URLInfoAbout" "http://www.baidu.com" WriteRegStr ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" "Publisher" "${PRODUCT_PUBLISHER}" @@ -206,15 +206,15 @@ SectionEnd Section "服务程序" -;WriteRegStr HKLM Software\Microsoft\Windows\CurrentVersion\Run Shell $INSTDIR\硬件驱动及通信程序\AllPass.SignalR.Hardware.Client\硬件程序启动脚本_客户端.bat +;WriteRegStr HKLM Software\/Microsoft\/Windows\/CurrentVersion\/Run Shell $INSTDIR\/硬件驱动及通信程序\/AllPass.SignalR.Hardware.Client\/硬件程序启动脚本_客户端.bat call GetWindowsVersion Pop $R0 ${If} $R0 == 'XP' -;CopyFiles $SMPROGRAMS\$ICONS_GROUP\千目容器.lnk "C:\Documents and Settings\All users\「开始」菜单\程序\启动" +;CopyFiles $SMPROGRAMS\/$ICONS_GROUP\/千目容器.lnk "C:\/Documents and Settings\/All users\/「开始」菜单\/程序\/启动" ${ElseIf} $R0 == '2003' -;CopyFiles $SMPROGRAMS\$ICONS_GROUP\千目容器.lnk "C:\Documents and Settings\All users\「开始」菜单\程序\启动" +;CopyFiles $SMPROGRAMS\/$ICONS_GROUP\/千目容器.lnk "C:\/Documents and Settings\/All users\/「开始」菜单\/程序\/启动" ${Else} -;CopyFiles $SMPROGRAMS\$ICONS_GROUP\千目容器.lnk "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp" +;CopyFiles $SMPROGRAMS\/$ICONS_GROUP\/千目容器.lnk "C:\/ProgramData\/Microsoft\/Windows\/Start Menu\/Programs\/StartUp" ${EndIf} SectionIn RO SectionEnd @@ -233,21 +233,21 @@ SectionEnd Section Uninstall !insertmacro MUI_STARTMENU_GETFOLDER "Application" $ICONS_GROUP - Delete "$SMPROGRAMS\$ICONS_GROUP\软件卸载.lnk" - Delete "$SMPROGRAMS\$ICONS_GROUP\启动硬件程序.lnk" - RMDir /r "$SMPROGRAMS\$ICONS_GROUP" - delete "C:\Documents and Settings\All users\「开始」菜单\程序\启动\千目容器.lnk" - delete "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp\千目容器.lnk" + Delete "$SMPROGRAMS\/$ICONS_GROUP\/软件卸载.lnk" + Delete "$SMPROGRAMS\/$ICONS_GROUP\/启动硬件程序.lnk" + RMDir /r "$SMPROGRAMS\/$ICONS_GROUP" + delete "C:\/Documents and Settings\/All users\/「开始」菜单\/程序\/启动\/千目容器.lnk" + delete "C:\/ProgramData\/Microsoft\/Windows\/Start Menu\/Programs\/StartUp\/千目容器.lnk" - ; ${WordFind2X} "\$INSTDIR" "\" "\" "-1" $R1 ;提取输入的ip,后面function使用 + ; ${WordFind2X} "\/$INSTDIR" "\/" "\/" "-1" $R1 ;提取输入的ip,后面function使用 SetOutPath "$INSTDIR" - nsExec::Exec "$INSTDIR\Uninstall.bat" - RMDir /r "$INSTDIR\IOTContainer" - RMDir /r "$INSTDIR\log" + nsExec::Exec "$INSTDIR\/Uninstall.bat" + RMDir /r "$INSTDIR\/IOTContainer" + RMDir /r "$INSTDIR\/log" RMDir /r "$INSTDIR" - delete "$INSTDIR\卸载千目应用.exe" - DeleteRegKey /ifempty HKCU "Software\QianMuContainer" + delete "$INSTDIR\/卸载千目应用.exe" + DeleteRegKey /ifempty HKCU "Software\/QianMuContainer" DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" SectionEnd @@ -271,8 +271,8 @@ Function .onInit ${GetDrives} "HDD" "FindHDD" - ReadRegStr $INSTDIR HKCU \ -"Software\QianMuContainer" address + ReadRegStr $INSTDIR HKCU \/ +"Software\/QianMuContainer" address ${If} $INSTDIR == '' StrCpy $INSTDIR $R2Container ;${Else} @@ -281,7 +281,7 @@ ${If} $INSTDIR == '' ;${WordFind2X} ":$disk" ":" ":" "-1" $R1 ;提取输入的ip,后面function使用 ;StrCpy $disk1 $R1 - File `/ONAME=$PLUGINSDIR\sed.exe` `Sources\sed.exe` + File `/ONAME=$PLUGINSDIR\/sed.exe` `Sources\/sed.exe` ; SectionSetFlags ${autoStart} 0 ; 安装选项,默认勾选 1, 不勾选 0 #InitPluginsDir ;创建互斥防止重复运行 @@ -307,12 +307,12 @@ Function GetWindowsVersion Push $R0 Push $R1 ClearErrors -ReadRegStr $R0 HKLM \ -"SOFTWARE\Microsoft\Windows NT\CurrentVersion" CurrentVersion +ReadRegStr $R0 HKLM \/ +"SOFTWARE\/Microsoft\/Windows NT\/CurrentVersion" CurrentVersion IfErrors 0 lbl_winnt ; we are not NT -ReadRegStr $R0 HKLM \ -"SOFTWARE\Microsoft\Windows\CurrentVersion" VersionNumber +ReadRegStr $R0 HKLM \/ +"SOFTWARE\/Microsoft\/Windows\/CurrentVersion" VersionNumber StrCpy $R1 $R0 1 StrCmp $R1 '4' 0 lbl_error StrCpy $R1 $R0 3 @@ -365,28 +365,28 @@ FunctionEnd Function Replacewebconfig ;更改配置文件 web.config ClearErrors - FileOpen $9 "c:\tmp\replace1.bat" w + FileOpen $9 "c:\/tmp\/replace1.bat" w IfErrors done - FileWrite $9 "@echo off$\r$\n" - FileWrite $9 "setlocal enabledelayedexpansion$\r$\n" - FileWrite $9 "set file=$\"$INSTDIR\IOTContainer\ConUpdate.exe.config$\"$\r$\n" - FileWrite $9 "attrib -H -R %file%$\r$\n" - FileWrite $9 "copy c:\tmp\sed.exe C:\Windows\System32 /y$logPath$\r$\n" - FileWrite $9 "$disk1:$\r$\n" - FileWrite $9 "sed -i $\"s@http://192.168.0.128:8889@$\"$ipAddress$\"@g$\" %file%$logPath$\r$\n" + FileWrite $9 "@echo off$\/r$\/n" + FileWrite $9 "setlocal enabledelayedexpansion$\/r$\/n" + FileWrite $9 "set file=$\/"$INSTDIR\/IOTContainer\/ConUpdate.exe.config$\/"$\/r$\/n" + FileWrite $9 "attrib -H -R %file%$\/r$\/n" + FileWrite $9 "copy c:\/tmp\/sed.exe C:\/Windows\/System32 /y$logPath$\/r$\/n" + FileWrite $9 "$disk1:$\/r$\/n" + FileWrite $9 "sed -i $\/"s@http://192.168.0.128:8889@$\/"$ipAddress$\/"@g$\/" %file%$logPath$\/r$\/n" - FileWrite $9 "echo ----- sed替换 HRCM web.config 替换库和 url ----- $logPath$\r$\n" + FileWrite $9 "echo ----- sed替换 HRCM web.config 替换库和 url ----- $logPath$\/r$\/n" FileClose $9 done: - ${Unless} ${FileExists} "c:\tmp\replace1.bat" + ${Unless} ${FileExists} "c:\/tmp\/replace1.bat" MessageBox MB_OK|MB_ICONSTOP "0replace1writting web.comfig file error!" Abort ${EndUnless} - #ExecWait "c:\tmp\replace1.bat" + #ExecWait "c:\/tmp\/replace1.bat" ;不显示黑框框 - nsExec::Exec "c:\tmp\replace1.bat" + nsExec::Exec "c:\/tmp\/replace1.bat" FunctionEnd @@ -440,7 +440,7 @@ Function LEAVE ;按下一步按钮时消隐标题字。图片号+1 GetDlgItem $0 $HWNDPARENT 1038 ShowWindow $0 0 IntOp $pic_count $pic_count + 1 - SetBrandingImage /IMGID=1046 /RESIZETOFIT "$PLUGINSDIR\$pic_count.bmp" + SetBrandingImage /IMGID=1046 /RESIZETOFIT "$PLUGINSDIR\/$pic_count.bmp" FunctionEnd Function Back ;按上一步按钮时消隐标题字。图片号-1,如果小于1的话不减了 @@ -450,7 +450,7 @@ Function LEAVE ;按下一步按钮时消隐标题字。图片号+1 ShowWindow $0 0 IntCmp $pic_count 1 +2 +2 +1 IntOp $pic_count $pic_count - 1 - SetBrandingImage /IMGID=1046 /RESIZETOFIT "$PLUGINSDIR\$pic_count.bmp" + SetBrandingImage /IMGID=1046 /RESIZETOFIT "$PLUGINSDIR\/$pic_count.bmp" FunctionEnd Function GUIINIT @@ -458,9 +458,9 @@ Function LEAVE ;按下一步按钮时消隐标题字。图片号+1 ButtonEvent::AddEventHandler /NOUNLOAD 3 $R0 SetOutPath $PLUGINSDIR ;释放图片 - File "Sources\*.bmp" + File "Sources\/*.bmp" - SetBrandingImage /IMGID=1046 /RESIZETOFIT "$PLUGINSDIR\1.bmp" ;先出第一张图片 + SetBrandingImage /IMGID=1046 /RESIZETOFIT "$PLUGINSDIR\/1.bmp" ;先出第一张图片 StrCpy $pic_count 1 ;图片序号1 FunctionEnd */ @@ -481,11 +481,11 @@ FunctionEnd Function ExtractFiles InitPluginsDir - File /oname=$PLUGINSDIR\index.htm Sources\index.htm - File /oname=$PLUGINSDIR\1.jpg Sources\1.jpg - File /oname=$PLUGINSDIR\2.jpg Sources\2.jpg - File /oname=$PLUGINSDIR\3.jpg Sources\3.jpg - File /oname=$PLUGINSDIR\4.jpg Sources\4.jpg + File /oname=$PLUGINSDIR\/index.htm Sources\/index.htm + File /oname=$PLUGINSDIR\/1.jpg Sources\/1.jpg + File /oname=$PLUGINSDIR\/2.jpg Sources\/2.jpg + File /oname=$PLUGINSDIR\/3.jpg Sources\/3.jpg + File /oname=$PLUGINSDIR\/4.jpg Sources\/4.jpg FunctionEnd Function CreateStaticRect System::Call `*(i,i,i,i)i(0,24,300,116).R0`