The ScreenCapture below is taken from the Mojave native screenshot utility.
Moderator: Actually the screenshot is of the Josh Parnham - ShotBox annotation utility, which may be automatically invoked from the Mojave screen shot utility.
I have 2 questions:
1- is click at found image the only way to open the share menu ?
2- once I am in the share menu, I know how to pick one single item using the insert text by typing action. What would be the most effective KBM action to prompt the user after the share menu is open by asking 'do you want to email, send to Yoink or send to Evernote in other words type M for Mail, Y for Yoink and E for Evernote. I could do it using a Palette, but I think that is too complicated an approach.
The challenge here is to get a screenshot of the screenshot utility for use in KM Found Image Action.
I have tried and it is very difficult. The only way I found was to record a video.
Not sure how good of an image that will make for a KM Found Image Action.
IAC, I always consider KM Found Image as a last resort.
Given that we can script this tool in a shell script using "screencapture" command, I think that give some some good output options:
-M screen capture output will go to a new Mail message
-P screen capture output will open in Preview or QuickTime Player if video
-I screen capture output will open in Messages
-B<bundleid> screen capture output will open in app with bundleid
If you need other output, then I would use "screencapture" to output to clipboard, and then insert in, or attach to, the other app or output device, using a KM Prompt, either "Prompt with List" OR "Prompt for User input" using a popup of output choices.
@JMichaelTX is right when he says that shell scripts are the easiest way of creating ScreenCapture, but this is not a simple screencapture. It is the Mojave ScreenCapture with markup, the image annotation tool, so I cannot use the screenshot shell script (I read through all possible output options.
I found a solution using UI Browser and listening to @DanThomas ' excellent youtube video https://www.youtube.com/watch?v=C06EjbwKuY0&t=138s and I came up with the script below that works (it does click on share when I place the script in the macro after I complete my annotations) and allows me to choose mail, yoink etc by insert text by typing..
I have 2 problems:
1- I have still not resolved the problem above, ie how to ask the user to choose between mail, yoink or Evernote.
2- the script works but the screen flickers. By trial and error, I determined that activateapplication "screencaptureui" is optinal. The script works without it but the screen still flickers. Any idea why ?
thank you again both
activate application "screencaptureui"
tell application "System Events"
tell process "Screen Shot"
click button 11 of window "Screen Shot"
@ronald, I am confused. I thought you were talking about how to automate the built-in Mac Mojave+ screen shot utility. When that utility is running it is NOT possible to issue any keyboard commands, like a hotkey to trigger a KM Macro.
So, I think you are taking about automating the third party tool Josh Parnham - ShotBox . Is that correct?
If so, obviously that is a completely different task.
Even so, I could not get your UI script to work properly. It did NOT click on the Shotbox (aka "Screen Shot") share button. How and when are you triggering the UI macro?
@ronald, OK, after a reboot of my Mac I got the script to work.
Here's a macro with the script that allows you to pick the app to share to.
However, like so many macOS apps that have a dynamic menu, there is a 4-5 second delay after the popup menu is shown. It still works, there is just a delay.
There may be a workaround for that delay, but for now, this should get you started.
FWIW, SnagIt also has a Share menu, and, IMO, it is much smoother to do the screen capture, make annotations, and then share.