Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

_ielinkclickbytext partial matches?


  • Please log in to reply
11 replies to this topic

#1 aommaster

aommaster

    Adventurer

  • Active Members
  • PipPip
  • 140 posts

Posted 07 April 2008 - 05:20 PM

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!







#2 PsaltyDS

PsaltyDS

    Most Venerable Penguin

  • MVPs
  • 13,279 posts

Posted 07 April 2008 - 07:12 PM

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 Thenƒo݊÷ Ù:ºÚ"µÍ’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

#3 PsaltyDS

PsaltyDS

    Most Venerable Penguin

  • MVPs
  • 13,279 posts

Posted 07 April 2008 - 07:14 PM

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

#4 aommaster

aommaster

    Adventurer

  • Active Members
  • PipPip
  • 140 posts

Posted 07 April 2008 - 08:06 PM

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 :)

#5 iTechTed89

iTechTed89

    Seeker

  • Active Members
  • 10 posts

Posted 09 May 2012 - 01:43 AM

I cant seem to get this working... but i think it would help solve my problem here possibly → Here
Plain Text         
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


#6 iTechTed89

iTechTed89

    Seeker

  • Active Members
  • 10 posts

Posted 09 May 2012 - 02:48 AM

also wtf is
o݊÷ Ù:ºÚ"µÍ’YˆÝš[™Ò[”ÝŠ ˆÌ ͎Û[šÝ^   ˆÌ ͎Ü×Û[šÕ^ H[
?

#7 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 10,438 posts

Posted 09 May 2012 - 03:10 AM

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 an XP machine, 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!

 

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 editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

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.


#8 iTechTed89

iTechTed89

    Seeker

  • Active Members
  • 10 posts

Posted 09 May 2012 - 04:43 AM

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, 09 May 2012 - 04:48 AM.


#9 iTechTed89

iTechTed89

    Seeker

  • Active Members
  • 10 posts

Posted 09 May 2012 - 03:57 PM

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.

#10 BrewManNH

BrewManNH

    באָבקעס מיט קודוצ׳ה

  • MVPs
  • 10,438 posts

Posted 09 May 2012 - 04:43 PM

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 an XP machine, 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!

 

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 editorGUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.
GUIToolTip UDF Demo - Demo script to show how to use the GUIToolTip UDF to create and use customized tooltips. Latin Square password generator

 

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.


#11 iTechTed89

iTechTed89

    Seeker

  • Active Members
  • 10 posts

Posted 11 May 2012 - 11:18 PM

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

#12 DaleHohm

DaleHohm

    Think of IE as an API...

  • MVPs
  • 5,981 posts

Posted 11 May 2012 - 11:38 PM

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





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users