Here is a quick and unreliable macro that will do the job. I say unreliable because it requires the image to always be in the same place, visible from the top of the page, and your browser window to always have the same dimensions. It's a starting point though.
You will need to edit the hotkey, and the location of the image. You can use the "Get" button on the mouse move/click action to set the location inside your browser window where you want to click. If you need to scroll first then you should add a simulate scroll function.
@photoRobertson , welcome to Keyboard Maestro (KM) and its Forum.
KM is one of the best Mac automation tools available, the its Forum is one of the best and friendliest forums on the Internet. Whenever you reach a tough stumbling block trying to use KM, please feel free to post your question/problem here for help.
Do you need it at a higher quality than as displayed on the screen? Because Keyboard Maestro could simply capture the screen area for you, which would be trivial.
That's an interesting solution. I am using Safari, but could use Chrome on the Mac.
In regards to the original solution, should I be able to physically see Keyboard Maestro perform a right-click and select the menu option, or will this occur in the background with no visible event?
I am writing this for two different web pages including a LinkedIn Profile page. I have also used an action to set the exact window size prior to performing the right-click so it should work but doesn't for some reason. Do I need to enable something somewhere? I already have accessibility turned on for Keyboard Maestro.
Hmm, yes, I think you should see the right click context menu. Perhaps a short pause between right clicking and typing would help?
In any case, if it is in the same part of the page each time then using javascript to get the image URL and downloading it might work better. I'm currently working on a macro to do just that for something else but I suspect other users would give you a better solution as I'm far from an expert.
Try the "Move or Click mouse" action:
there you can specify right click at X,Y coordinates
then another action can move the mouse down the menu and click at copy image
I tried my script in Google Chrome with the same effect. Other Macros such as Activate Google Chrome and resizing windows works fine. It is just the Right-click macro that is not working with either browser for some reason.
And I am using version 8.2.4 of Keyboard Maestro on an iMac running Mojave
for the avvo one try separating the action in two, one for moving, one for right-clicking:
1.- Move or click mouse: just move to absolute position 205, 321
2.- Move or click mouse: Right click
works in Safari.
also you might need to add a pause if your computer is too fast.
The problem is that even if my mouse click is at the wrong location, I should still see the right-click menu and I am not seeing it. Its like the Right Click action is not performing at all. Here is my steps I am trying...
dumb question:
in your computer > System Preferences > Security & Privacy
did you allow KM and the KM engine in the Accessibility and th eAutomation tabs?
they should have a check next to their icon, or if you don't see them, you should add them.
OK, I got the right-click macro to start working by performing the following:
Uncheck and delete KBM & KBM Engline
Reboot machine
Reneable KBM & KBM Engine settings when prompted by Keybard Maestro
But, now I have a new problem. the right menu appears, but the "Insert Text by Typing" macro is not working so the menu item is not selected. And it also scrolls the web page up.
Finally solved that issue too but putting a 2 second pause before typing the text.
I was able to get it working in Google Chrome a much shorter pause:
Even on my old Mid-2010 MacBook Pro I was able to get Safari to work reliably with only a 0.5 second pause, although I haven't added many extensions.
This brute-force method of getting the profile pic is likely quite adequate for your needs at the moment, but it's also possible to scrape the image URL from the DOM (Document Object Model) using JavaScript.
Once you have that you can use the curl command line tool (or other) to download the image and then process it however you want.
In this macro I've downloaded the image from the LinkedIn page you referenced above to the /tmp/ directory and then copied it to the clipboard.
Thanks so much for your advice and suggestions for improvement. Part of the reason I put in longer delays is that for LinkedIn, they don't like it if you use automation tools and will restrict your account for awhile if they detect this. In regards to using Javascript with the DOM is a much cleaner solution and one that I will probably implement in the future as an enhancement as relying on the GetImage macro to determine if a generic photo is there before copying the image to the clipboard is a little kludgy. But for now it works and I just have it run while I am away.