发现确实是js,参考了_IEAction 的第二个例子,解决了
据说是js把返回的值给拿去用了,没有返回,程序就一直假死
代码如下:
#include <IE.au3>
;-----------------点登录对话框----------------------
Run('C:\Program Files\Internet Explorer\IEXPLORE.EXE 192.168.1.1')
WinWait("Connect to 192.168.1.1","")
If Not WinActive("Connect to 192.168.1.1","") Then WinActivate("Connect to 192.168.1.1","")
WinWaitActive("Connect to 192.168.1.1","")
ControlClick("Connect to 192.168.1.1", "OK", "[CLASS:Button;INSTANCE:2]","left",1) ;点OK按钮
;ControlSend("Connect to 192.168.1.1","","[CLASS:Button;INSTANCE:2]", "{ENTER}") ;这个也可以
;Send("{ENTER}") ;这个也可以
;------------------操作---------------------------
$oIE = _IEAttach ("TL-WR340G 54M无线宽带路由器","Title")
$oFrame = _IEFrameGetObjByName ($oIE, "bottomLeftFrame")
_IELinkClickByText ($oFrame, "无线参数")
$oFrame = _IEFrameGetObjByName ($oIE, "mainFrame")
$oForm = _IEFormGetCollection ($oFrame, 0)
_IEFormElementCheckboxSelect ($oForm, 2, "ap", 1, "byValue") ;开启无线功能
;----------------------------------------------------------
$oQuery = _IEFormElementGetObjByName ($oForm, "Save")
;~ $oIE = _IEAction($oQuery ,"click") ;点"保存" _IELoadWait($oIE)
$hwnd = _IEPropertyGet($oIE, "hwnd")
_IEAction ($oQuery, "focus")
ControlSend($hwnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]", "{Enter}")
; Wait for Alert window, then click on OK
WinWait("Microsoft Internet Explorer", "无线网络设置的更改将")
ControlClick("Microsoft Internet Explorer", "无线网络设置的更改将", "[CLASS:Button; Instance:1;]")
;-------------------询问关机------------------------------
$return = MsgBox(4,"shutdown","shutdown in 60 seconds", "60")
Select
Case $return = -1
Run(@ComSpec & " /c " & 'shutdown -f -s', "", @SW_HIDE)
Case $return = 6
Run(@ComSpec & " /c " & 'shutdown -f -s', "", @SW_HIDE)
Case $return = 7
Exit
EndSelect
发现有问题还是要靠自己解决啊! |