Im looking for some assistance with a watch folder/drag files action

I am looking to create an action that would do the following:

Watch a folder on my desktop for any jpegs. When Jpegs appear, will drag images into the program “JPEGmini” which will compress the images. JPEGmini would be a small window simple app that would be to be opened and the way it works is it compresses anything that gets dragged into its program window. Once that happens then the action will move the images to the the “compressed” folder.

Could I get the wisdom from you guys to help create this action? Much appreciation!

Generally speaking, you don't want to resort to simulating drag and drops unless there's really no other option. Assuming JPEGmini can also open files directly without explicitly dragging them into its window, I would first try something like this:

Example Macro.kmmacros (1.8 KB)

You'll need to change the folder path and app used, but this should get you started. You didn't say where JPEGmini saves the compressed images, but I imagine you could use a macro similar to this to move those where you want them too.

I just checked and yeah the only way it optimizes files is either by dragging the image files themselves or dragging a folder with images into the application's window.

I have JPEGmini Pro and when it is run it offers the File > Open menu to open and optimise files. See the screenshot:

I don't know if it works for folders, but it certainly works for individual images. So there is a definite possibility to automate this with KM without resorting to drag/drop.

Ok great! Initially it didnt work but now it is. perfect! Thanks guys.

1 Like

The problem I am facing now is that when choosing to open the image by the jpegmini program,the program says it cannot open file type. However, if I go into the program and click "open" and selecting the image it then works.

Can’t offer much help, but I found this discussion that may offer you a way to move forward Wanted: Keyboard Maestro Automation with JPEGMini. It’s a long thread and it doesn’t sound completely positive about jpegmini I’m afraid but YMMV.

There's a macro in the thread @tiffle linked to that shows how to automate the open/save dialogue with JPEGmini here: Wanted: Keyboard Maestro Automation with JPEGMini
But honestly, unless there's some reason you absolutely have to use JPEGmini, I would follow the advice in the post directly after that one and try ImageOptim instead if you want anything that's truly automatable: https://imageoptim.com/mac

1 Like