user2518751
user2518751

Reputation: 735

AutoIt - How to click on a link matches a certain pattern

I need to be able to search through a source code of a web page for a link matches a specific pattern and if there's a match - open it in a new window. I don't care about the browser, could be either IE or Chrome.

What I was able to achieve so far (which is not even close to what I need) is this:

MsgBox(0,"message box",StringRegExp("www.example.com/d12345/abcde.html","www.example.com/d\d*/abcde.html"))

So basically, if the string www.example.com/d12345/abcde.html exists in the source code, I am getting '1' in return. What I need is, that if a string matches the pattern - open the link in a new window. Could someone suggest how to achieve this?

Thank you for your help.

Upvotes: 0

Views: 122

Answers (1)

Xenobiologist
Xenobiologist

Reputation: 2151

  1. get all links (complete url) in your file.
  2. search through those links for your match
  3. If match then Shellexecute the url.

Upvotes: 1

Related Questions