本帖最后由 tubaba 于 2017-6-17 21:49 编辑
回复 155# txm888
我电脑是win10 64位,不管是3.3.6.1还是3.3.14.2都报这个错误.
如果是winxp IE8可以运行,那只有到公司再说了
>运行:(3.3.6.1):G:\AutoIt3_3361\autoit3.exe "G:\autoit_script\Au3Encode\测试用\error\新建 AutoIt v3 脚本.au3"
G:\AutoIt3_3361\Include\IE.au3 (1965) : ==> Variable must be of type "Object".:
Return SetError($_IEStatus_Success, 0, $o_object.document.body.innerText)
Return SetError($_IEStatus_Success, 0, $o_object.document^ ERROR
->20:56:12 AutoIT3.exe 完成:[CODE]:1
>运行:(3.3.14.2):G:\AutoIt3_33142\autoit3.exe "G:\autoit_script\Au3Encode\测试用\error\新建 AutoIt v3 脚本.au3"
--> 按 Ctrl+Alt+Break 重新启动或按 Ctrl+Break 停止
"G:\AutoIt3_33142\Include\IE.au3" (1599) : ==> The requested action with this object has failed.:
Return SetError($_IESTATUS_Success, 0, $oObject.document.body.innerText)
Return SetError($_IESTATUS_Success, 0, $oObject.document^ ERROR
->20:59:08 AutoIt3.exe 结束.rc:1
+>20:59:08 AccAu3Wrapper 完成.
>Exit code: 1 Time: 1.33
我怎么感觉是你程序逻辑上的问题呢??试过原始的脚本在scite中调试吗
看这个函数
Func _WebDZ($web = "", $title = "", $user = "", $pass = "", $save = 1)
If $web = "" Then Return -1
If Not IsHWnd($FormWeb) Then
$FormWeb = GUICreate($title, @DesktopWidth, @DesktopHeight - 40, 0, 0, $WS_POPUP)
$mini = GUICtrlCreateLabel("", @DesktopWidth / 2 + 538, 0, 24, 24)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKTOP + $GUI_DOCKRIGHT)
GUICtrlSetTip(-1, "最小化")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetCursor(-1, 0)
$close = GUICtrlCreateLabel("", @DesktopWidth / 2 + 564, 0, 24, 24)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKTOP + $GUI_DOCKRIGHT)
GUICtrlSetTip(-1, "关闭")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetCursor(-1, 0)
$Label0 = GUICtrlCreateLabel("", 0, 0, @DesktopWidth, 60, $SS_CENTERIMAGE, $GUI_WS_EX_PARENTDRAG)
GUICtrlSetResizing(-1, $GUI_DOCKSIZE + $GUI_DOCKTOP)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
$oIE = _IECreateEmbedded()
$GUIActiveX = GUICtrlCreateObj($oIE, -1, -1, @DesktopWidth + 20, @DesktopHeight - 40 + 20)
GUISetState(@SW_SHOW)
GUICtrlSetOnEvent($mini, "_mini")
GUICtrlSetOnEvent($close, "_exit")
AdlibRegister("_WinMove", 50) ;每50毫秒调用_WinMove函数,第一次调用时,如果脚本没有执行完下面的_IELoadWait($oIE, 1 * 1000, 5 * 1000),_IEBodyReadText就会失败.看错误提示Return SetError($_IESTATUS_Success, 0, $oObject.document^ ERROR,说明$oObject是对象,但它的引用$oObject.document请求动作失败
SendKeepActive($FormWeb)
EndIf
WinSetTitle($FormWeb, "", $title)
_IENavigate($oIE, $web, 0)
_IELoadWait($oIE, 1 * 1000, 5 * 1000) ;在这里才加载完毕.在这之后调用_IEBodyReadText($oIE)就可获取文本
EndFunc ;==>_WebDZ
把adlibRegister("_WinMove", 50)移动到 _IELoadWait($oIE, 1 * 1000, 5 * 1000) 后试试 |