#Persistent
#NoEnv
programName = 探测qq启动与否 ; DEBUG: to do
programVersion =3.1 beta ; DEBUG: to do
programFullName = %programName% v%programVersion%
programAuthor = sunwind(1576157) liuyukuan@msn.com ; DEBUG: to do
description=目前实现探测qq启动与否
; construct tray menu -- DEBUG: optional
GoSub, trayMenu
; end of auto-execute section
;初始化
v_Enable=0
Process,Exist,qq.exe ;检测qq.exe进程是否存在
pc1:=ErrorLevel ;将返回值存入pc1(获取qq.exe的PID), 如果不存在返回值为0。
if (pc1=0) ;等于0, 说明qq.exe进程不存在
{
qqOn1=0
qqOff1=1
}
else
{
qqOn1=1
qqOff1=0
}
SetTimer, Label0, 2000
Return
Label0:
{
Process,Exist,qq.exe
pc1:=ErrorLevel ;将返回值存入pc1(获取qq.exe的PID), 如果不存在返回值为0。
if (pc1=0) ;等于0, 说明qq.exe进程不存在
{
qqOn2=0
qqOff2=1
}
else
{
qqOn2=1
qqOff2=0
}
;~ MsgBox %qqOn2%,%qqOff2%
if Abs(qqOn2-qqOn1)!=0 And qqOn2=1
{
QQON="qq启动了"
msgbox ,4096,,%QQON%
}
Else If qqOn2=1
{
QQON="qq运行中"
}
if Abs(qqOff2-qqOff1)!=0 And qqOff2=1
{
QQON="qq退出了"
msgbox ,4096,, %QQON%
}
Else IF qqOn2=0
{
QQON="qq未启动"
}
;~ OutputDebug,%QQON%
;~ showtext(QQON)
qqOn1:=qqOn2
qqOff1:=qqOff2
}
Return
; construct tray menu -- DEBUG: optional
trayMenu:
; set tray tip
Menu, Tray, Tip, %programFullName%
; disable standard menu items
Menu, Tray, NoStandard
; show info message
Menu, Tray, Add, &About, about
; separator
Menu, Tray, Add
; terminate script
Menu, Tray, Add, &Quit, quit
Return
$F4:: ;按F4停止开启 检测qq.exe 计时器
{
v_Enable:=!v_Enable
If (v_Enable=0)
{
SetTimer, Label0, OFF
MsgBox,已经停止监测!
;~ SetTimer, Label1, Off
}
Else
{
SetTimer, Label0, 2000
MsgBox,已经恢复监测!
;~ SetTimer, Label1, 3000
}
}
Return
; [ALT]+[ESC]: terminate script
!ESC::
Suspend ; exempt from suspension -- DEBUG: optional
GoSub, quit
Return
; show info message -- DEBUG: to do, optional
about:
MsgBox, 64, %programFullName%,
( LTrim
%programFullName%
%A_Space%by %programAuthor%
简介:%description%
Use [ALT]+[ESC] to terminate the program.
Use [F4] 停止或者恢复检测.
)
Return
; terminate script
quit:
; restore clipboard contents -- DEBUG: optional (see above)
Clipboard := clipboardBak
; terminate script
ExitApp
Return