#include <IE.au3>
#include <Excel.au3>
HotKeySet("{Esc}", "_Exit")
Local $path = @ScriptDir & "\ECAT.xlsx"
$oExcel = _ExcelBookOpen($path,0)
_ExcelSheetActivate($oExcel, "ECAT")
For $x = 1 To 2 Step 1
$ip = _ExcelReadCell($oExcel,$x,1)
$ip1 = _ExcelReadCell($oExcel,$x,2)
$ip2 = _ExcelReadCell($oExcel,$x,3)
$ip3 = _ExcelReadCell($oExcel,$x,4)
$ip4 = _ExcelReadCell($oExcel,$x,5)
$id = _ExcelReadCell($oExcel,$x,6)
$fq =_ExcelReadCell($oExcel,$x,7)
$oIE = _IECreate($ip)
WinSetState("[CLASS:IEFrame]","",@SW_MAXIMIZE)
$oForm = _IEFormGetObjByName($oIE, "loginForm")
Local $oQuery = _IEFormElementGetObjByName($oForm, "username")
_IEFormElementSetValue($oQuery, "admin")
Local $oQuery = _IEFormElementGetObjByName($oForm, "passwd")
_IEFormElementSetValue($oQuery, "admin")
Local $oQuery = _IEFormElementGetObjByName($oForm, "loginbtn")
_IEAction($oQuery, "click")
_IELoadWait($oIE)
;;;;;;;;;;;;;;;;
Local $zFrame = _IEFrameGetObjByName($oIE, "contents")
_IELinkClickByIndex($zFrame,1)
_IELoadWait($zFrame)
Local $ipFrame = _IEFrameGetObjByName($oIE, "main_screen")
_IELoadWait($ipFrame)
_IELinkClickByIndex($ipFrame, 1)
$frmForm = _IEFormGetObjByName($ipFrame, "frmSetup")
;;;;;;;;;;;;;;
Local $oForm = _IEFormGetObjByName($frmForm, "frmSetup")
Local $frmQuery = _IEFormElementGetObjByName($frmForm, "DeviceID")
_IEFormElementSetValue($frmQuery, $id)
Local $frmQuery = _IEFormElementGetObjByName($frmForm, "VMAddress",0)
_IEFormElementSetValue($frmQuery, "52")
Local $frmQuery = _IEFormElementGetObjByName($frmForm, "VMAddress",1)
_IEFormElementSetValue($frmQuery, "18")
Local $frmQuery = _IEFormElementGetObjByName($frmForm, "VMAddress",2)
_IEFormElementSetValue($frmQuery, "2")
If $fq= "南白" Then
Local $frmQuery = _IEFormElementGetObjByName($frmForm, "VMAddress",3)
_IEFormElementSetValue($frmQuery, "21")
ElseIf $fq = "汇川区" Then
Local $frmQuery = _IEFormElementGetObjByName($frmForm, "VMAddress",3)
_IEFormElementSetValue($frmQuery, "11")
Else
MsgBox(4096,"是哪个区",$fq)
EndIf
_IELoadWait($frmForm)
;~ ;改好设置以后点击确定
Sleep(300)
$oSubmit = _IEGetObjByName($frmForm, "okbtn")
Local $hwnd = _IEPropertyGet($frmForm, "hwnd")
_IEAction($oSubmit, "focus")
Sleep(300)
Send("{Enter}")
Sleep(300)
Send("{Enter}")
;~ _IELoadWait($frmForm)
;~ MsgBox(4096,"下一个","5秒以后开始",5)
Sleep(5000)
_ExcelWriteCell($oExcel,"OK",$x,9)
WinClose("[CLASS:IEFrame]")
Next
_ExcelBookClose($oExcel,1,0)
Func _Exit()
_ExcelBookClose($oExcel,1,0)
Exit
EndFunc |