Sign in to follow this  
Followers 0

_ielinkclickbytext partial matches?

12 posts in this topic

Posted

Hi guys!

Okay... so let's just say some hypothetical person is having a lot of fun with the IE functions in autoit :)

This hypothetical person wants to have autoit click a link in IE that partially matches the string he provides. For example, assume that below are links on a web page:

*Home

*Boards

*News

*Contacts

*Departments

*Art Gallery

So, if autoit is provided the word "art" in the _IELinkClickbyText function, it will click departments if the index it is given is 0. If it is given 1, then it will click Art Gallery.

Thanks guys!

Share this post


Link to post
Share on other sites



Posted

Hi guys!

Okay... so let's just say some hypothetical person is having a lot of fun with the IE functions in autoit :)

This hypothetical person wants to have autoit click a link in IE that partially matches the string he provides. For example, assume that below are links on a web page:

*Home

*Boards

*News

*Contacts

*Departments

*Art Gallery

So, if autoit is provided the word "art" in the _IELinkClickbyText function, it will click departments if the index it is given is 0. If it is given 1, then it will click Art Gallery.

Thanks guys!

You could just hack your copy of IE.au3. Copy the _IELinkClickByText() function to a new name, i.e. _IELinkClickByString(), then change just one line inside the function:

From:

If $linktext = $s_linkText ThenoÝ÷ Ù:ºÚ"µÍYÝ[Ò[Ý	ÌÍÛ[Ý^	ÌÍÜ×Û[Õ^
H[

:)

Share this post


Link to post
Share on other sites

Posted

P.S. Don't expect support from Dale for any hacked versions of IE.au3...

:)

Share this post


Link to post
Share on other sites

Posted

P.S. Don't expect support from Dale for any hacked versions of IE.au3...

:)

Hehe... that is pure genius! It works perfectly!

Strange he wouldn't give support... it's all his code with a minor tweak :)

Share this post


Link to post
Share on other sites

Posted

I cant seem to get this working... but i think it would help solve my problem here possibly →

Func _IELinkClickByString(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?oÝ?÷ Ù:ºÚ"µÍ?Y?Ý?[?Ò[?Ý? ?ÌÍ?Û[?Ý^  ?ÌÍ?Ü×Û[?Õ^
H[
   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

Share this post


Link to post
Share on other sites

Posted

also wtf is

oÝ÷ Ù:ºÚ"µÍYÝ[Ò[Ý ÌÍÛ[Ý^  ÌÍÜ×Û[Õ^
H[
?

Share this post


Link to post
Share on other sites

Posted

That's a corrupted code tag, that isn't supposed to be there, which is why it's not working for you.

Share this post


Link to post
Share on other sites

Posted (edited)

meaning? just use this?

If $linktext = $s_linkText Then

or is that the line i need to change

and if so to what?

Edited by iTechTed89

Share this post


Link to post
Share on other sites

Posted

still pretty lost on this wish dane made a function for this... i did see in anouther old topic he was thinking about it but dont know what became of it.

Share this post


Link to post
Share on other sites

Posted

You could ask PsaltyDS what he wrote there, he might recall it.

Share this post


Link to post
Share on other sites

Posted

anyone got any advice on how to get this working i did msg DS but he hasnt been online since april

Share this post


Link to post
Share on other sites

Posted

Just use

If StringInStr($linktext, $s_linkText) Then

Dale

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0