Func _IELinkClickByText(ByRef $o_object, $s_linkText, $i_index = 0, $f_wait = 1)
If Not IsObj($o_object) Then
__IEErrorNotify("Error", "_IELinkClickByText", "$_IEStatus_InvalidDataType")
Return SetError($_IEStatus_InvalidDataType, 1, 0)
EndIf
;
Local $found = 0, $linktext, $links = $o_object.document.links
$i_index = Number($i_index)
For $link In $links
$linktext = $link.outerText & "" ; Append empty string to prevent problem with no outerText (image) links
;~ If $linktext = $s_linkText Then ;原来是=,好像必须完全匹配
If StringInStr ($linktext,$s_linkText) Then ;我改成包含了,但是没验证能不能成功
If ($found = $i_index) Then
$link.click
If $f_wait Then
_IELoadWait($o_object)
Return SetError(@error, 0, -1)
EndIf
Return SetError($_IEStatus_Success, 0, -1)
EndIf
$found = $found + 1
EndIf
Next
__IEErrorNotify("Warning", "_IELinkClickByText", "$_IEStatus_NoMatch")
Return SetError($_IEStatus_NoMatch, 0, 0) ; Could be caused by parameter 2, 3 or both
EndFunc ;==>_IELinkClickByText
瞎改的,不知道能不能行 |