#NoTrayIcon
#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_Icon=C:\WINDOWS\system32\SHELL32.dll
#PRE_Outfile=..\54.exe
#PRE_Res_Comment=B.H.
#PRE_Res_Description=B.H.
#PRE_Res_Fileversion=0.0.0.0
#PRE_Res_LegalCopyright=B.H.
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <GUIConstants.au3> ;包含文件GUIConstants.au3 到脚本开头
#include <WindowsConstants.au3> ;包含窗口控件
#include <StaticConstants.au3>
#include <ProgressConstants.au3>
Opt("TrayOnEventMode", 1) ;应用OnEvent函数于系统托盘图标
Opt("guicloseonesc", 0) ;此处为程序运行时按下ESC不发送消息,否则按下ESC键后,退出程序
Dim $rpath = @ScriptDir & "\runline.dat",$Time=10,$wait = 0
;以下为检查配置文件设置
$soft_ini = FileOpen("runline.dat", 0) ;打开配置文件
If $soft_ini = -1 Then
MsgBox(16, "错误", '请检查配置文件' & @ScriptDir & '"runline.dat"是否存在!') ;@ScriptDir为脚本所在目录
quit()
EndIf
$chars = FileReadLine($soft_ini, 1) ;从已打开的文本文件中读取第3行的字符
If $soft_ini <> -1 Then
If $chars <> ";制作:YP,QQ:380025440" Then
MsgBox(16, "警告", "请保留作者的信息!" & @CRLF & "否则,程序不能继续运行!")
MsgBox(64, "请保留作者的信息", '作者的信息为:' & @CRLF & ';制作:YP,QQ:380025440' & @CRLF & '你己经修改为:' & @CRLF & $chars)
quit()
EndIf
EndIf
FileClose($soft_ini) ;关闭此前打开的文本文件
$Form = GUICreate("", 262, 56, -1, -1, $WS_POPUP, $WS_EX_LAYERED) ;创建窗体
GUISetBkColor(0xABCDEF)
_API_SetLayeredWindowAttributes($Form, 0xABCDEF)
Local $Labtime = GUICtrlCreateLabel("", 1, 1, 260, 14)
Local $Pro = GUICtrlCreateProgress(1, 20, 260, 15) ;创建下载进度条
Local $sLabe2 = GUICtrlCreateLabel("", 1, 40, 100, 14)
GUISetState(@SW_SHOW) ; 显示一个空白的窗口
Func _API_SetLayeredWindowAttributes($hwnd, $i_transcolor, $Transparency = 255, $isColorRef = False)
Local Const $AC_SRC_ALPHA = 1
Local Const $ULW_ALPHA = 2
Local Const $LWA_ALPHA = 0x2
Local Const $LWA_COLORKEY = 0x1
If Not $isColorRef Then
$i_transcolor = Hex(String($i_transcolor), 6)
$i_transcolor = Execute('0x00' & StringMid($i_transcolor, 5, 2) & StringMid($i_transcolor, 3, 2) & StringMid($i_transcolor, 1, 2))
EndIf
Local $Ret = DllCall("user32.dll", "int", "SetLayeredWindowAttributes", "hwnd", $hwnd, "long", $i_transcolor, "byte", $Transparency, "long", $LWA_COLORKEY + $LWA_ALPHA)
Select
Case @error
Return SetError(@error, 0, 0)
Case $Ret[0] = 0
Return SetError(4, 0, 0)
Case Else
Return 1
EndSelect
EndFunc ;==>_API_SetLayeredWindowAttributes
AdlibRegister("_Timer", 10 * $time) ;启用 Adlib 功能,每隔10 * $time时间就调用函数一次
Func _Timer()
GUICtrlSetData($Pro, $wait) ;设置进度条的初始值为0
;以下为秒后自动安装所选项
Local $S = 0
For $S = 0 To $Time Step 1 ;从0开始,步进值为1
;在$Labtime显示“$Time - $S”秒后自动安装所选项
If GUICtrlRead($Pro) = $S * 10 / ($Time / 10) Then GUICtrlSetData($Labtime, $Time - $S & "秒后自动安装所选项")
Next
$wait = $wait + 1
If $wait = 105 Then YX()
EndFunc ;==>_Timer
; 运行界面,直到窗口被关闭
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
Func YX()
If $cmdline[0] <> 0 Then
Select
Case $cmdline[1] = "help"
_Softhelp()
Case Else
_RunOnceSec($cmdline[1])
EndSelect
Else
_RunAllSec()
EndIf
quit()
EndFunc
Func _RunOnceSec($cmdl_1)
$Singlevar = IniReadSection($rpath, $cmdl_1)
If Not @error Then
For $si = 2 To $Singlevar[0][0]
Select
Case $Singlevar[1][1] = 0
_JudgeSuffix($Singlevar[$si][1], 0)
Case $Singlevar[1][1] = 1
_JudgeSuffix($Singlevar[$si][1], 1)
Case $Singlevar[1][1] = 2
_JudgeSuffix($Singlevar[$si][1], 2)
Case $Singlevar[1][1] = 3
_JudgeSuffix($Singlevar[$si][1], 3)
EndSelect
Next
EndIf
EndFunc ;==>_RunOnceSec
Func _RunAllSec()
$var = IniReadSectionNames($rpath)
If Not @error Then
For $i = 1 To $var[0]
$varR = IniReadSection($rpath, $var[$i])
If Not @error Then
For $ir = 2 To $varR[0][0]
Select
Case $varR[1][1] = 0
_JudgeSuffix($varR[$ir][1], 0)
Case $varR[1][1] = 1
_JudgeSuffix($varR[$ir][1], 1)
Case $varR[1][1] = 2
_JudgeSuffix($varR[$ir][1], 2)
Case $varR[1][1] = 3
_JudgeSuffix($varR[$ir][1], 3)
EndSelect
Next
EndIf
Next
EndIf
EndFunc ;==>_RunAllSec
Func _JudgeSuffix($jsuffix, $x)
If StringInStr(StringRight($jsuffix, 4), ".msi") Or _
StringInStr(StringRight($jsuffix, 4), ".msc") Or _
StringInStr(StringRight($jsuffix, 4), ".vbs") Or _
StringInStr(StringRight($jsuffix, 4), ".cpl") Or _
StringInStr(StringRight($jsuffix, 4), ".scr") Then
Select
Case $x = 0
ShellExecute($jsuffix)
Case $x = 1
ShellExecuteWait($jsuffix)
Case $x = 2
ShellExecute($jsuffix, "", "", "", @SW_HIDE)
Case $x = 3
ShellExecuteWait($jsuffix, "", "", "", @SW_HIDE)
EndSelect
Else
Select
Case $x = 0
Run($jsuffix, "")
Case $x = 1
RunWait($jsuffix, "")
Case $x = 2
Run($jsuffix, "", @SW_HIDE)
Case $x = 3
RunWait($jsuffix, "", @SW_HIDE)
EndSelect
EndIf
EndFunc ;==>_JudgeSuffix
Func _Softhelp()
MsgBox(0, "Help", _
"软件不支持中文目录及中文路径" & @LF _
&"[run]" & @LF _
&"w名称可自定义" & @CRLF _
&"如w x y z a ......" & @CRLF _
&"w=0 依次执行,不等待" & @CRLF _
&"w=1 依次等待执行" & @CRLF _
&"w=2 不等待隐藏执行" & @CRLF _
&"w=3 等待隐藏执行" & @CRLF _
&"字段之间依次执行")
EndFunc ;==>_Softhelp
;皮肤退出
Func Quit()
GUISetState(@SW_HIDE)
Exit
EndFunc ;==>Quit