Jump to content
Macro Express Forums

Identify hyperlink text selected with tab key


Recommended Posts



I am looking to identify a hyperlink text in IE which is highlighted after landing on the link from tabbing through the webpage.


I would either like to copy the displayed text of the hyperlink and use the IF command to verify if it contains a required variable,




Use a variable to confirm if the hyperlink selected is the correct one or not using another option.


I hope I explained adequately!




Link to comment
Share on other sites

I would use something like,



move mouse to cursor

right click

move mouse set distance to 'copy link location' and click

save clipboard to var1 and var2

modify var1 keeping only the first 7 characters

if var1 equals http:// -> continue, else go back to the first line

then use "IF VARIABLE" with the "CONTAINS" switch on VAR2 for your intended searching




Hope I helped!


As a followup, why don't you write a macro that saves the HTML file of the page to a text file and then process the text file searching for hyperlinks instead? You could avoid a lot of potential issues this way. I think the help file for 'text file begin process' is pretty helpful IIRC.


If you try to use tab to go through links on just whatever webpage (I'm assuming you want to do some data mining) the tab key is going to take you off-screen and move mouse to cursor might not behave like it should. To get around this you could have it save cursor position, check to see where that is (if its off-screen) and if it is do a page down until it is visible. I'm not sure how 'move mouse to cursor' works if the cursor is not visible. I would only use this option if it's required to interact with other software.


The main difference here is that using text file process to save to variables and then comparing strings is going to be probably five to ten times faster than the other way around, especially if you are just doing this on whatever random webpage to count content.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...