Suggestions on Automating This (Context Menu)

I would like to automate uploading an image to Imgur via a context menu. This is currently how it's done:

https://photos.app.goo.gl/mNYkDiryepuAHXqE7

I'd like to be able to do it with only two clicks. Is there a way?

Thanks.

Do you install any Imgur App in Mac? I can't get Imgur in my Mac share menu.

Hey Al,

Are you uploading anonymously – or to your own account?

-Chris

Do you install any Imgur App in Mac?

Yes. ImGuru.

Are you uploading anonymously – or to your own account?

To my own account, apparently. I say "apparently" because ImGuru has problems. That is, you tell it to authorize the app for your account, but when it gives you the PIN, there's nowhere to enter it. However, it seems to work anyway.

This workflow is hard to automate since App Extensions is huge different to User Automation. Unless use some sorts of clumsy GUI-Scripting or Click Find image Action.

Use Shell Script, contact to Imgur directly via API will be much easier. I find this:

and this (shared the same name with the tool you used):

Hey Al,

First I'd ask the developer to add a keyboard shortcut to upload the selected item(s) in the Finder.

In Keyboard Maestro you can make a macro to right-click at the current mouse-pointer position using a Move or Click Mouse action.

Then use an Insert Text by Typing action to select the share menu.

Keypress Space to open the share menu.

Insert Text by Typing action to select imguru.

Keypress Return to activate imguru.

Like this:

Finder ⇢ Upload to imgur with imGuru Share Menu.kmmacros (19 KB)

I've disabled the last (grayed-out) action, because I don't have imGuru on my system – and it hitting Return will cause an unexpected item to be selected.

I've tried the binary for FigBug/imguru's command line tool, and it works fine – but it's an anonymous upload and has no facility to add your account information.

Bart Nagel's shell script looks like just the ticket though. I'll look it over more carefully later this afternoon.

-Chris

Hey Al,

See this link for somewhat more detailed instructions on how to acquire the image-to-find.

Drag Finder selection to “Found Image” in Chrome Browser window

I've used both GraphicConverter and SnagIt for zooming and cropping the image very carefully, and I can get an image of the selection-color plus a little outline such that my macro works (on my machine) for both icon and list view.

I just tested Preview for this, and it works fine as well.

Using a For Each action in the Found Images Collection is more robust than what I've done above, because the image you use doesn't need to be as unique.

NOTE – These are ACTIONS and will open in the macro currently being edited in the Keyboard Maestro Editor.

For Each.kmactions (14 KB)

See how I've broken out of the loop after the first iteration?

So all I need is a decently sized swatch of the Finder Highlight Color that's still small enough not to be interfered with by Finder-names and other bits of GUI.

This is robust and quite fast even on my old 17-inch, Mid 2010, i7 MacBook Pro.

-Chris

1 Like

You guys are great. Thanks.

1 Like

I have tried this also times over a screenshot @PianoAl. But now I've started to open the Finder window (desktop is selected as start) and then use an AppleScript to access the context menu - Share - App.

iMessage

iMessage.kmmacros (2,1 KB)

ScreenFlow

I'm working on this. I tried duplicating your macro, Christopher, but inserting the text didn't work for selecting the menu.

I've set it up so that I put the mouse cursor over the image (on the desktop) that I want to upload and type the trigger hotkey.

The macro looks like this:


The image I have is of the Share option in the context menu. The error I get is "No unique image found ..."

Where am I going wrong?

Thanks.

I'm putting off learning AppleScript stuff for now ...

Ah. It wasn't finding the image because I didn't put in a Pause.

This works (and I used it for to upload the below image), but perhaps it's less elegant than it should be.

Hey Al,

It works is generally more important that it's elegant.

I prefer both of course, but I don't always get what I want...   :sunglasses:

-Chris