本帖最后由 jack2684 于 2011-9-14 21:41 编辑
请看下面两个段代码,第一个是没问题的。第二个问题很诡异,运行循环的时候会报IE.au3里面的error,而且每次报的时机和行数还未必会相同!!
比如有时报If String($oItem.type^ ERROR ,有时报_IETagNameGetCollection($oTemp, "input")^error (还会报其他错误,我就不贴出来了),太令人无解了
第二段代码只是在第一段的基础上多加了几行而已.(多加的那几行我贴在后面)
这是没问题的代码:
Func _JwcSelect($goIE)
$cir=1
$c=0
$bottomFrame=_IEFrameGetObjByName($goIE,"bottomFrame")
$menuFrame=_IEFrameGetObjByName($bottomFrame,"menuFrame")
While $cir
_IELinkClickByTitle($menuFrame,"id","individual",1)
$mainFrame=_IEFrameGetObjByName($bottomFrame,"mainFrame")
$gsMainFrame=$mainFrame
;_IELinkClickByTitle($mainFrame,"name","pagelink",2)
$courses=_IEFrameGetObjByName($gsMainFrame,"inforUpContent")
If $courses==0 Then
GUICtrlSetData($Edit1,"框架获取失败,重试。。。"& @CRLF,1)
$cir=1
Sleep(500)
ContinueLoop
EndIf
$oForm=_IETagNameGetCollection ($courses,"form",1)
;MsgBox(0,"form数量",@extended)
If @extended=0 Then
GUICtrlSetData($Edit1,"列表失败,重试。。"& @CRLF,1)
$cir=1
Sleep(500)
ContinueLoop
EndIf
If _IEFormElementCheckboxSelect($oForm,0,"",1,"byIndex")<>0 Then
_JwcConfirm($goIE)
GUICtrlSetData($Edit1,"<DONE>"& @CRLF,1)
Else
$c+=1
GUICtrlSetData($Edit1,"<"&$c&">",1)
EndIf
;$cir=_IELinkClickByTitle($gsMainFrame,"name","pagelink",1)
;If $cir=0 Then
; GUICtrlSetData($Edit1,"时间结束..."& @CRLF,1)
;EndIf
_IELoadWait($goIE)
Sleep(500)
WEnd
EndFunc
这是有诡异问题的代码
Func _JwcSelect($goIE)
$cir=1
$c=0
$bottomFrame=_IEFrameGetObjByName($goIE,"bottomFrame")
$menuFrame=_IEFrameGetObjByName($bottomFrame,"menuFrame")
While $cir
_IELinkClickByTitle($menuFrame,"id","individual",1)
$mainFrame=_IEFrameGetObjByName($bottomFrame,"mainFrame")
$gsMainFrame=$mainFrame
;_IELinkClickByTitle($mainFrame,"name","pagelink",2)
$oCourses=_IEFrameGetObjByName($gsMainFrame,"inforUpContent")
If $oCourses==0 Then
GUICtrlSetData($Edit1,"框架获取失败,重试。。。"& @CRLF,1)
$cir=1
Sleep(500)
ContinueLoop
EndIf
$oSelected=_IEGetObjByName($oCourses,"kch")
_IEDocInsertText($oSelected,GUICtrlRead($input5))
$searchs=$oCourses.document.images
For $search In $searchs
If $search.title=="过滤" Then
$search.click
ExitLoop
EndIf
Next
$oForm=_IETagNameGetCollection ($oCourses,"form",1)
;MsgBox(0,"form数量",@extended)
If @extended=0 Then
GUICtrlSetData($Edit1,"列表失败,重试。。"& @CRLF,1)
$cir=1
Sleep(500)
ContinueLoop
EndIf
If _IEFormElementCheckboxSelect($oForm,0,"",1,"byIndex")<>0 Then
_JwcConfirm($goIE)
GUICtrlSetData($Edit1,"<DONE>"& @CRLF,1)
Else
$c+=1
GUICtrlSetData($Edit1,"<"&$c&">",1)
EndIf
;$cir=_IELinkClickByTitle($gsMainFrame,"name","pagelink",1)
;If $cir=0 Then
; GUICtrlSetData($Edit1,"时间结束..."& @CRLF,1)
;EndIf
_IELoadWait($goIE)
Sleep(500)
WEnd
EndFunc
这是第二段相对于第一段增加的部分,就是一个“写入”和“点击”的动作而已
$oSelected=_IEGetObjByName($oCourses,"kch")
_IEDocInsertText($oSelected,GUICtrlRead($input5))
$searchs=$oCourses.document.images
For $search In $searchs
If $search.title=="过滤" Then
$search.click
ExitLoop
EndIf
Next
|