帮他改一下
#include <IE.au3>
#include <GUIConstants.au3>
Opt("GUIOnEventMode", 1) ;========>注意这句
$oi1=IniRead("auto.ini", "auto", "ipaddr", "")
$oi2=IniRead("auto.ini", "auto", "times", "")
$oi3=IniRead("auto.ini", "auto", "sleep", "")
$oi4=IniRead("auto.ini", "auto", "user", "")
$oi5=IniRead("auto.ini", "auto", "password", "")
$oi6=IniRead("auto.ini", "auto", "re", "")
$oi7=IniRead("auto.ini", "auto", "P", "")
#Region ### START Koda GUI section ### Form=f:documents and settingsadministrator桌面form1.kxf
$Form1 = GUICreate("TEST_V0.1", 283, 110, 193, 125)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked") ;========>注意这句
$Label1 = GUICtrlCreateLabel("欢迎使用自动重启程序", 24, 16, 107, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$Label2 = GUICtrlCreateLabel("完成了", 64, 48, 88, 17)
$Label4 = GUICtrlCreateLabel("0次!", 152, 48, 120, 17)
$Label5 = GUICtrlCreateLabel("作者:xxx", 216, 88, 57, 17)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
case GUIGetMsg()=0
If $oi7=1 Then
$oi=1
While $oi<=$oi2
$oIE1 = _IECreate($oi1,0,0,1,0)
$oForm = _IEFormGetObjByName ($oIE1, "loginForm")
$oQuery = _IEFormElementGetObjByName ($oForm, "U2")
_IEFormElementSetValue ($oQuery, $oi4)
$oQuery = _IEFormElementGetObjByName ($oForm, "P2")
_IEFormElementSetValue ($oQuery, $oi5)
Sleep(1000)
_IEFormSubmit ($oForm)
Sleep(1000)
$oIE2 = _IECreate($oi1 & $oi6,0,0,1,0)
_IEQuit($oIE1)
$inputs=_IEGetObjById($oIE2,"idSubmit")
_IEAction($inputs,"click")
Sleep(5000)
_IEQuit($oIE2)
$oi=$oi+1
If $oi-1=$oi2 Then
GUICtrlSetData( $Label4,$oi-1&"次!")
MsgBox(0,"TEST OVER","执行"&$oi2&"次测试完毕!")
Sleep(2147483647)
ElseIf $oi<=$oi2+1 Then
GUICtrlSetData( $Label4,$oi-1&"次!")
Else
MsgBox(0,"!","未知错误!")
EndIf
sleep($oi3*1000)
WEnd
ElseIf $oi7=2 Then
$oi=1
While $oi<=$oi2
$oie = _IECreate ($oi1,0,0,1,0)
$oform = _IEFormGetObjByName ($oie, "loginForm")
$otext = _IEFormElementGetObjByName ($oform, "P2")
_IEFormElementSetValue ($otext, "admin")
_IEFormSubmit ($oform)
Sleep(1000)
$form2=_IEGetObjByName($oie,"reboot")
_IEAction($form2,"click")
Sleep(2000)
_IEQuit($oie)
$oi=$oi+1
If $oi-1=$oi2 Then
GUICtrlSetData( $Label4,$oi-1&"次!")
MsgBox(0,"TEST OVER","执行"&$oi2&"次测试完毕!")
Sleep(2147483647)
ElseIf $oi<=$oi2+1 Then
GUICtrlSetData( $Label4,$oi-1&"次!")
Else
MsgBox(0,"!","未知错误!")
EndIf
sleep($oi3*1000)
WEnd
Else
MsgBox(0,"提示消息","P值配置错误!请重新检查配置文件!")
EndIf
EndSwitch
WEnd
Func CLOSEClicked()
Exit
EndFunc |