Jump to content

_IElinkclickbytext with variable?!


Giwan
 Share

Recommended Posts

With _IElinkclickbytext I can only click on links like this: www.google.com

Now I'd like to know a solution for clicking links on this format: www.google.com/db36ed3b723dh382dh78dh23

The first part of the link is always the same, but the remainder is always different, so I need a variable or something like this.

THX 4all posts!

Link to comment
Share on other sites

You say you are using _IELinkClickByText, but it appears that you are really trying to key off of the href of the link insead of the link text displayed in the browser.

In any case, you can either use _IELinkClickByIndex or you can take full control by using a combination of _IELinkGetCollection and _IEAction with "click" - e.g.

#include <IE.au3>
$oIE = _IECreate("your-url")
$oLinks = _IELinkGetCollection ($oIE)
$sHref = "string to look for"
For $oLink In $oLinks
    MsgBox(0, "Link Info", $oLink.href)
    If StringInStr(String($oLink.href), $sHref) Then ; Force String just in case you hit a null value
        _IEAction($oLink, "click")
        ExitLoop
    EndIf
Next

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

Link to comment
Share on other sites

  • 10 months later...

Thank you very much for this script it helped me for a long time!

Now I have a problem.

I have the same links like this: www.google.com/db36ed3b723dh382dh78dh23

but I now I have a few identical links in this format.

For exaple: google.com/1234784748444444

google.com/1234554354342432

google.com/1234545354432434

google.com/1234556754342432

google.com/1234522254432434

With your script I put in the area "string to look for" the string "google.com/1234", but then it will open only the first link. Can you change the script, that it will open all links?

Thankfully Giwan (and sorry for my bad English).

Link to comment
Share on other sites

O.o

That would quickly clutter the screen, unless this is some sort of click-scam money bot....

but I digress.

You'd have to look into possibly opening a new browser when it finds the string "1234" .... _IECreate($oLink.href)

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

That are only three links to open, so I don't think that it would sclutter the screen.

I thought it could go with an additional instruction like string + 1 or so. I am not so good in programming, so I it does not help me really what you have written Blue Drache <_<... You have to make examples :)...

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...