#NoTrayIcon
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Timers.au3>
Global $time = 9
$Form1 = GUICreate("打开文件", 345, 120, -1, -1)
$Label2 = GUICtrlCreateLabel("9 秒后进入安装程序", 16, 76, 150, 24)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
$Button1 = GUICtrlCreateButton("浏览..", 272, 35, 57, 26,0)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
$Button2 = GUICtrlCreateButton("确定", 168, 72, 73, 33,$BS_DEFPUSHBUTTON);$BS_DEFPUSHBUTTON
GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif")
$Button3 = GUICtrlCreateButton("取消", 256, 72, 73, 33, 0)
GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif")
$Label1 = GUICtrlCreateLabel("选择文件位置", 17, 13, 76, 20)
GUICtrlSetFont(-1, 11, 400, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput("D:\SoftIns2.0\SoftIns2.0.exe", 16, 35, 249, 24)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)
AdlibEnable("_timer", 1000)
GUICtrlSetState($Button1,$GUI_DISABLE)
GUICtrlSetState($Button2,$GUI_DISABLE)
GUICtrlSetState($Input1,$GUI_DISABLE)
$timer1 = _Timer_Init()
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE,$Button3
Exit
Case $Button1
$var = FileOpenDialog("打开",@HomeDrive& "", _
"可执行文件 (*.exe;*.com;*.bat)",1+4,GUICtrlRead($Input1));,GUICtrlRead($Input1)
If @error Then
Else
GUICtrlSetData($Input1,$var)
EndIf
Case $Button2
do
$ba=GUICtrlRead($Input1)
If Not(FileExists($ba))Then
MsgBox(0+64,"消息","未找到此文件,请重新输入!")
ExitLoop
EndIf
Until Run($ba)
Exit;运行后此软件退出
EndSwitch
If $time <= 0 Then
AdlibDisable()
main()
EndIf
If _Timer_GetIdleTime() <= _Timer_Diff($timer1) Then
AdlibDisable()
GUICtrlSetState($Button1,$GUI_ENABLE)
GUICtrlSetState($Button2,$GUI_ENABLE)
GUICtrlSetState($Label2,$GUI_DISABLE)
GUICtrlSetState($Input1,$GUI_ENABLE)
EndIf
WEnd
AdlibDisable()
Exit
Func _timer()
$time -= 1
GUICtrlSetData($Label2, $time & " 秒后进入安装程序")
If $time <= 0 Then
AdlibDisable()
EndIf
EndFunc ;==>_timer
Func main()
$ba=GUICtrlRead($Input1)
If Not(FileExists($ba))Then
MsgBox(0+64,"消息","未找到此文件,请重新输入!")
EndIf
Run($ba)
Exit ;倒计时运行软件,此软件退出
EndFunc ;==>main