最新消息:

NSIS自动检测

nsis 永恒心锁 1455浏览 0评论
!include "MUI.nsh"
OutFile "S32.exe"

!define MUI_PAGE_CUSTOMFUNCTION_PRE ComponentsPage1Pre
!insertmacro MUI_PAGE_COMPONENTS

Sectiongroup "完整独立程序" SecOL3
 Section /o "QQ直播程序" Sec60
 SectionIn 1 2
 SetOutPath "$TEMP"
setoverwrite on
 File "QQLive5.0.3240.exe"
 ExecWait '"$TEMP\QQLive5.0.3240.exe /S'
SectionEnd
 Section /o "QQ音乐程序" Sec20
 SectionIn 1 2
 SetOutPath "$TEMP"
setoverwrite on
 File "QQMusicClickInstall.exe"
 ExecWait '"$TEMP\QQMusicClickInstall.exe /S'
SectionEnd
 Section /o "QQ医生程序" Sec30
 SectionIn 1 2
 SetOutPath "$TEMP"
setoverwrite on
 File "qqdoctor1.3kb1setup.exe"
 ExecWait '"$TEMP\qqdoctor1.3kb1setup.exe /S'
SectionEnd
 Section /o "QQ旋风程序" Sec50
 SectionIn 1
 SetOutPath "$TEMP"
setoverwrite on
 File "qqdownload1.4b1.exe"
 ExecWait '"$TEMP\qqdownload1.4b1.exe /S'
SectionEnd
 Section /o "QQ游戏程序" Sec40
 SectionIn 1 2
 SetOutPath "$TEMP"
setoverwrite on
 File "QQGame2007Beta1_setup.EXE"
 ExecWait '"$TEMP\QQGame2007Beta1_setup.EXE /S'
SectionEnd
 SectionGroupend

Function ComponentsPage1Pre
 Call Check1
 Call Check2
 Call Check3
 Call Check4
 Call Check5
FunctionEnd

Function Check1
IfFileExists $PROGRAMFILES\NSIS\NSIS.exe skip
 !insertmacro UnselectSection ${Sec60}
 skip:
FunctionEnd

Function Check2
IfFileExists $PROGRAMFILESA\A.exe skip
 !insertmacro UnselectSection ${Sec20}
 skip:
FunctionEnd

Function Check3
IfFileExists $PROGRAMFILES\DAEMON Tools\DAEMON.exe skip
 !insertmacro UnselectSection ${Sec30}
 skip:
FunctionEnd

Function Check4
IfFileExists $PROGRAMFILES\QQGAME\Game.exe skip
 !insertmacro UnselectSection ${Sec40}
 skip:
FunctionEnd

Function Check5
IfFileExists $windir\notepad skip
 !insertmacro UnselectSection ${Sec50}
 skip:
FunctionEnd
=====================================================
上下源码均为NSIS自动检测。罾心製作DIY。
=====================================================
!include Sections.nsh

Name TestSelectSection
OutFile "TestSelectSection.exe"

Page components
Page instfiles
ShowInstDetails show

Sectiongroup "完整独立程序" SecOL3
 Section /o "QQ直播程序" Sec60
 SectionIn 1 2
 SetOutPath "$TEMP"
setoverwrite on
 File "QQLive5.0.3240.exe"
 ExecWait '"$TEMP\QQLive5.0.3240.exe /S'
SectionEnd
 Section /o "QQ音乐程序" Sec20
 SectionIn 1 2
 SetOutPath "$TEMP"
setoverwrite on
 File "QQMusicClickInstall.exe"
 ExecWait '"$TEMP\QQMusicClickInstall.exe /S'
SectionEnd
 Section /o "QQ医生程序" Sec30
 SectionIn 1 2
 SetOutPath "$TEMP"
setoverwrite on
 File "qqdoctor1.3kb1setup.exe"
 ExecWait '"$TEMP\qqdoctor1.3kb1setup.exe /S'
SectionEnd
 Section /o "QQ旋风程序" Sec50
 SectionIn 1
 SetOutPath "$TEMP"
setoverwrite on
 File "qqdownload1.4b1.exe"
 ExecWait '"$TEMP\qqdownload1.4b1.exe /S'
SectionEnd
 Section /o "QQ游戏程序" Sec40
 SectionIn 1 2
 SetOutPath "$TEMP"
setoverwrite on
 File "QQGame2007Beta1_setup.EXE"
 ExecWait '"$TEMP\QQGame2007Beta1_setup.EXE /S'
SectionEnd
 SectionGroupend

IfFileExists $windir\notepad.exe QQliveExists PastQQliveCheck
QQliveExists:
 !insertmacro SelectSection ${SEC60}
PastQQliveCheck:
;/////////////////////QQ音乐//////////////////////////////////////////////////
IfFileExists $windir\notepad.exe QQmusicExists PastQQmusicCheck
QQmusicExists:
 !insertmacro SelectSection ${SEC20}
PastQQmusicCheck:
;/////////////////////QQ医生//////////////////////////////////////////////////
IfFileExists $windir\notepad.exe QQdoctorExists PastQQdoctorCheck
QQdoctorExists:
 !insertmacro SelectSection ${SEC30}
PastQQdoctorCheck:
;/////////////////////QQ旋风//////////////////////////////////////////////////
IfFileExists $windir\notepad.exe QQdownloadExists PastQQdownloadCheck
QQdownloadExists:
 !insertmacro SelectSection ${SEC40}
PastQQdownloadCheck:
;//////////////////////QQ游戏/////////////////////////////////////////////////
IfFileExists $windir\notepad.exe QQgameExists PastQQgameCheck
QQgameExists:
 !insertmacro SelectSection ${SEC50}
PastQQgameCheck:
FunctionEnd

!include Sections.nsh

Section "Photoshop plug-ins" ps_plugins
SectionEnd

Function .onInit
IfFileExsists $PROGRAMFILES\Photoshop\main.exe psins
!insertmacro SelectSection ${ps_plugins}
Goto done
psins:
!insertmacro UnselectSection ${ps_plugins}
done:
FunctionEnd
免责声明:根据《计算机软件保护条例》第十七条规定“为了学习和研究软件内含的设计思想和原理,通过安装、显示、传输或者存储软件等方式使用软件的,可以不经软件著作权人许可,不向其支付报酬。”您需知晓本站所有内容资源均来源于网络,仅供用户交流学习与研究使用,版权归属原版权方所有,版权争议与本站无关,用户本人下载后不能用作商业或非法用途,需在24个小时之内从您的电脑中彻底删除上述内容,否则后果均由用户承担责任;如果您访问和下载此文件,表示您同意只将此文件用于参考、学习而非其他用途,否则一切后果请您自行承担,如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。丨本站为个人博客非盈利性站点,所有软件信息均来自网络,所有资源仅供学习参考研究目的,并不贩卖软件,不存在任何商业目的及用途。丨本文采用知识共享 署名4.0国际许可协议 [BY-NC-SA] 进行授权BY-NC-SA协议进行授权

转载请注明:永恒心锁-分享互联网 » NSIS自动检测

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