KBM Macro for Generating iCloud Share Link

I am looking for the best method to share a selected file in Finder and generate an iCloud share link to my clipboard.

I am new to KBM, but am very proficient with computers. Just can’t find the right sequence of actions.
What would be the most efficient way to do this?

What are the exact steps to do this manually?
Tell us that, and I'm sure we can help build a macro for you.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

@Mark_Robertson, welcome to Keyboard Maestro (KM) and its Forum.
KM is one of the best Mac automation tools available, 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.

You will also find this helpful:
Tip: How Do I Get The Best Answer in the Shortest Time?

Getting Started with Keyboard Maestro

For more help, see Getting Started with Keyboard Maestro and the Forum .

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Thank you.

So, the easiest way to do it manually (though maybe not the best for KM), is to secondary-click the file -> choose "Share" from the context menu -> select "Add People," where you would see this image ->

-> then you would select "Copy Link," which brings up this contextual menu ->

50%20AM

where you must select the "Share Options," where I would want "Anyone with the link" and "View Only" selected from the dropdown menus -> then you would click "Share" (the "Ok" button) -> the link would then be copied to the clipboard (which is what I would want).

My problem so far is that I can't figure out a way to access the contextual menu on a file selection through KM. I could potentially figure out the rest with "Move and Click" or image recognition.

You can try it with…

  1. a click action, then
  2. insert the appropriate text that leads to the correct submenu

Like here: