Sign in to follow this  
Followers 0

_ielinkclickbytext partial matches?

12 posts in this topic

#1 ·  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



#2 ·  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[

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted

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

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#4 ·  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

#5 ·  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

#6 ·  Posted

also wtf is

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

Share this post


Link to post
Share on other sites

#7 ·  Posted

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


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#8 ·  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

#9 ·  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

#10 ·  Posted

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


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

#11 ·  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

#12 ·  Posted

Just use

If StringInStr($linktext, $s_linkText) Then

Dale


Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl

MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model

Automate input type=file (Related)

Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded  Better Better?

IE.au3 issues with Vista - Workarounds

SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?

Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble

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