Jump to content
Macro Express Forums

Easy macro ?


Recommended Posts

Easy Macro ? Not for me yet !!

 

Hello I'm looking for how to locate a Download Link on a web page (chrome navigator) and how to click on this link to save file .

 

Anchor text of link is "Download" ..i don't find how to move mouse on this link and to have a right mouse clik ..

 

Thanks for anyhelp

Link to comment
Share on other sites

What you are describing is not an easy macro to script, unless the "Download" link is always exactly in the same position relative to the window or the screen.

 

Assuming the link is at position (100, 200) relative to the window (measured from the top left corner):

 

Mouse Move: 100, 200 Relative to Current Window
Mouse Right Click

You need a different approach If the link's position changes. Assuming (1) the word "Download" is text (as opposed to an image of text), and (2) the word appears only once per screen, you can do something like this:

 

Text Type (Simulate Keystrokes): <CONTROL>f
Text Type (Simulate Keystrokes): Download
Text Type (Simulate Keystrokes): <ESC>
Text Type (Simulate Keystrokes): <CONTROL>s

Basically, this script searches for the word Download, then cancels the search. In Chrome, this action gives keyboard focus to the entire link that contains the search term. Ctrl + S is the keyboard shortcut for "Save," which Chrome supports.

 

You may need short delays between steps. You might discover that this approach works better in Firefox or IE.

 

PS: If you opt the second approach, it will be challenging to move the mouse cursor to the focused link. The Macro Express command that moves the mouse to the text cursor position does not work in web browsers. Right clicking the link will likely be an exercise in frustration!

 

Other keyboard shortcuts that might get you close to a solution, rather than <CONTROL>s, include:

 

1. Text Type (Simulate Keystrokes): <APP>

2. Text Type (Simulate Keystrokes): <SHIFT><F10>

 

Both the Application key and Shift + F10 are supposed to be keyboard equivalents for right clicking; but my limited experience with Chrome is that they are not exact equivalents: they may bring up a different context menu than one would expect. For this reason, Firefox or IE may be easer to script via Macro Express.

Link to comment
Share on other sites

  • 2 weeks later...

What I do is download the raw HTML, find and extract the link in the HTML text, then navigate to that. I often use an external VBScript to get the page contents and do the rest in MEP. But if that's too daunting you can also use the "View Source" option and copy everything to the clipboard. But I don't know the command in Chrome. AS Alan described doing things in the browsers GUI is tricky, even for the best MEP users.

 

I write a lot of scrapers and things like this for hire where they need to run without the GUI or process thousands of records. MEP is usually pretty good to do short runs with simple macros but if you have problems and need an efficient and cost effective

solution for large batches let me know.

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.

Guest
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.

Loading...
 Share

×
×
  • Create New...