#include <GUIConstants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <GDIPlusEx.au3>
#include <String.au3>
#Include <Date.au3>
#include <Winhttp_GetRespond.au3>
#include <ie.au3>
Opt("WinTitleMatchMode", 2)
While 1
ToolTip(ControlGetText ("Windows Internet Explorer", "", 'Edit1'),5,5)
if StringInStr(ControlGetText ("Windows Internet Explorer", "", 'Edit1'),"http://t.qq.com/") Then
$wb_url=ControlGetText ("Windows Internet Explorer", "", 'Edit1')
ExitLoop
EndIf
Sleep(100)
WEnd
Local $i,$aArray,$oSpans,$oSpan
$IE = _IECreateEmbedded ()
$sub2=GUICreate("wb", 402, 386,5,5)
GUICtrlCreateObj($IE, 0, 0, 402,386)
;GUISetState(@SW_hide)
GUISetState(@SW_show)
_IENavigate ($IE, $wb_url)
if IsObj($ie) Then
$oSpans = _IETagNameGetCollection($IE, "U")
if IsObj($oSpans) Then
For $oSpan In $oSpans
if IsObj($oSpan) Then
If StringInStr($oSpan.outerhtml, "首页") Then
Sleep(3000)
MsgBox(0,"2","")
For $x=40 To 310 Step 40
ControlClick ("wb","","","left",1,$x,237)
Next
$oSpan.click
Sleep(1000)
$oText = _IEGetObjById ($ie, "msgTxt")
_IEFormElementSetValue ($oText, "你好!")
Sleep(2000)
$oSpans = _IETagNameGetCollection($IE, "INPUT")
if IsObj($oSpans) Then
For $oSpan In $oSpans
if IsObj($oSpan) Then
If StringInStr($oSpan.title, "广播") Then
$oSpan.click
EndIf
EndIf
Next
EndIf
;ExitLoop 这里不加EXITLOOP让循环一直下去就会出错
EndIf
EndIf
Next
EndIf
EndIf
While 1
Sleep(100)
WEnd
为什么那个EXITLOOP不去掉的话,执行代码就会出现:
The requested action with this object has failed.:
If StringInStr($oSpan.outerhtml, "??") Then
If StringInStr($oSpan.outerhtml^ ERROR
这种错误提示呀?如何才能不加EXITLOOP,循环到结束也不会出错退出呢? |