#Region ;**** 参数创建于 ACNWrapper_GUI ****
#PRE_UseX64=n
#PRE_Res_requestedExecutionLevel=None
#EndRegion ;**** 参数创建于 ACNWrapper_GUI ****
#include <GUIConstantsEx.au3>
#include <ButtonConstants.au3>
#include <StaticConstants.au3>
Break (0)
Dim $Wait_Time="5"
Wait_PowerON()
Func Wait_PowerON()
$Form = GuiCreate("Wait_Device", 500, 350)
$label0=GUICtrlCreateLabel("请等待。。。",30,50,400,60)
GUICtrlSetFont($label0, 25, 800, "", "Comic Sans MS")
$label1=GUICtrlCreateLabel("退出请按 ESC",300,300,400,60)
GUICtrlSetFont($label1, 20, 400, "", "Comic Sans MS")
GUICtrlSetColor($label1, 0xff0000)
$label2=GUICtrlCreateLabel("等待剩余时间 : " ,50,200,400,60)
GUICtrlSetFont($label2, 20, 800, "", "Comic Sans MS")
GuiSetState()
WinSetOnTop("Wait_Device", "", 1)
While 1
Wait_Device()
WEnd
EndFunc
Func Wait_Device()
RunWait(@ComSpec & ' /c ' & 'adb kill-server', '', 0)
RunWait(@ComSpec & ' /c ' & 'adb start-server', '', 0)
For $i = 1 To $Wait_Time
FileDelete ("dev.log")
$label2=GUICtrlCreateLabel("等待剩余时间 : " & $Wait_Time-$i ,50,200,400,60)
GUICtrlSetFont($label2, 20, 800, "", "Comic Sans MS")
RunWait(@ComSpec & ' /c ' & 'adb devices > dev.log', '', 0)
$file = FileOpen("dev.log", 0)
$line = FileReadLine($file,2)
FileClose($file)
$result = StringInStr($line, "device")
If Not $result = 0 Then
FileDelete ("dev.log")
RunWait(@ComSpec & ' /c ' & 'adb kill-server', '', 0)
Exit
Else
WinActivate ("Wait_Device")
Sleep(2000)
HotKeySet("{ESC}", "Terminate")
If $i > $Wait_Time-1 Then
FileClose("dev.log")
FileDelete ("dev.log")
WinSetOnTop("Wait_Device", "", 0)
GUIDelete()
#comments-start
MsgBox(16,"等待超时","未检测到手机!")
Do
FileClose("dev.log")
FileDelete ("dev.log")
RunWait(@ComSpec & ' /c ' & 'adb kill-server', '', 0)
ProcessClose("cmd.exe")
Until (0 == ProcessExists ( "cmd.exe" ))
#comments-end
Continue_Wait()
EndIf
EndIf
Next
EndFunc
Func Terminate()
Do
FileClose("dev.log")
FileDelete ("dev.log")
RunWait(@ComSpec & ' /c ' & 'adb kill-server', '', 0)
ProcessClose("cmd.exe")
Until (0 == ProcessExists ( "cmd.exe" ))
Exit (2)
EndFunc
Func Continue_Wait()
$Form1 = GuiCreate("Wait_TimeOut", 400, 300)
$label3=GUICtrlCreateLabel("未侦测到手机 !",30,50,400,60)
GUICtrlSetFont($label3, 25, 800, "", "Comic Sans MS")
GUICtrlSetColor($label3, 0xff0000)
$Button_1 = GUICtrlCreateButton("重新等待", 50, 200, 100)
$Button_2 = GUICtrlCreateButton("退出", 250, 200, 100)
GuiSetState()
WinSetOnTop("Wait_TimeOut", "", 1)
While 3
$msg = GUIGetMsg()
Select
Case $msg = $Button_1
GUIDelete()
Wait_PowerON()
Case $msg = $Button_2
Terminate()
EndSelect
WinActivate ("Wait_TimeOut")
WEnd
EndFunc