Drag Finder selection to "Found Image" in Chrome Browser window

Is there a “Drag to found Image” option in KM? I want to drag the Finder selection to a specific point in a browser window. The target will always be the same image, but may move location.

I'm afraid there isn't a "Drag to found image" option, but if you're using KM8, you could try something like this that searches the new %FoundImage% token for the found image's coordinates and uses them in a Move or Click Mouse action:

[Example] Drag to Found Image.kmmacros (53.0 KB)

The drag should be drag absolute because the found image result will be an absolute coordinate.

If you store the token in a variable, you can use Variable Dot Notation to access the middle of the image.

1 Like

Thank you, both. I have no idea what I'm doing.

Peter, I did get your macro to respond but it is placing the cursor on the wrong screen. I am working with two screens. The "found image" is on screen 2 (secondary monitor).

Moved the browser window to screen 1 did not help. Cursor still moves offset from the "Found Image" target.

You’re quite welcome. In your screenshot, you’re still using “drag to” rather than “drag absolute”. Try changing that and see if it makes a difference.

Awesome! It works. Thanks so much. I have so much to learn, but the journey is rewarding.

2 Likes

You’re welcome again, and well said. I feel the same way :slightly_smiling_face:

1 Like

Ok, next question:

How can I make the drag start with the selected Finder item instead of relying on the mouse position?

Hey Ray,

You would have to get the position of the selected Finder item using System Events.

OR — you might be able to use a Find-Image Action to search for your highlight color.

-Chris

Thanks, I'll give it a try.

Meantime, when I run the current macro (attached) on a different computer, while in "Icon View" (which worked on originating computer) it tries to drag the Finder window instead of the document. But, if I change to "List View" the macro works. Any ideas why?

Drag to Fingerprint Drop Zone.kmmacros (16 KB)

Hey Ray,

No. I tested it here, and it works properly for both icon view and list view.

Since your macro is supposed to click at the mouse-position, it makes no sense that the window would be dragged...

Quit and restart your Keyboard Maestro engine and test again. If the problem still exists then reboot.

If it still persists then I'm out of ideas.


I found a means to reliably click the Finder selection in List-View.

If you look closely at the image to be found you'll see a gray area on the left:

I took an area screenshot that was precisely the height of the highlight area right next to the sidebar border — and I slightly overlapped to the left of the sidebar boundary.

This gives me a unique 4-tone image to find — and it works with one (or more) selected items.

You can't see the subtlety of the shading in that small image, so here's an 800% blow-up in SnagIt.

Here's the cursor position after the macro is run:

Whups — it fails on selected folders, because I've made it slightly too wide...

Okay — that was easily fixed by carefully cropping the image.

I've got it working with perfect reliability (so far), and it's acceptably fast.

-Chris

Have you considered another approach?

  1. Click in the area of the browser where you want the file
  2. Switch to Finder and select the file
    OR
    Select a file via a Choose File dialog
  3. Run Macro/script to copy the file, switch to browser, and paste.

Generally on the Mac, finding the location on the screen of the selection point is not easy to do. With the Finder it might be possible.

As @JMichaelTX suggests, an alternative might be selecting the file in the Finder and then Working with the Finder Selection.

Hey Folks,

It looks to me like Ray wants to drag files from the Finder into the upload area of a browser window.

Unless his target site has an API for uploading, Working with the Finder Selection is unlikely to be helpful.

While automating dragging and dropping files with the mouse is fragile, I think his task can be very possibly be accomplished by:

  1. Arranging browser and Finder windows so they are visible on screen at the same time.

  2. Using the method I outlined above to find the Finder selection coordinates for dragging.

  3. Find the coordinates of the target image on the web page.

  4. Click and drag between the two coordinates using a Move or Click Mouse action.

Ray ⇢ what browser are you using? If NOT Safari have you checked to make sure you can’t copy files in the Finder and paste them into your web page destination. (This technique works on the Keyboard Maestro forum in Chrome, Firefox, and some other NON-Safari browsers.)

-Chris

Thank you, all, for your great help. The current solution of moving the cursor over the target file is working for me. I click the file and leave the cursor in position. The macro drags the file to the browser drop zone then opens the file in Illustrator to perform vectorize process. The finished vector is saved to the same folder.

I will investigate more of the suggestions as time allows.

Chris, I'm not sure what you mean by "API" (in this specific case), but with the KM (Discourse) forum open to a Reply, I can copy a file (image file) from the Finder and then paste into the browser, which works fine.

My point was more along the lines that if the Ray is going to hover over the file, then it is not much more to select the file and then work with the Finder Selection instead of dragging, which gives some different automation possibilities.