Does anyone have a macro that opens every file of a specified type in nested folders, then resaves?

Hi,
I am new to KM and hoping to find a macro someone made which I can modify.
I need to select a folder
KM finds a file of a specified type and opens it.
KM goes to the FIle menu and picks Save As to save the file as a different type,
but in the same location as the original file.
KM closes the file.
KM goes to the next file.

I can use a Mac program called File Buddy to make a list of all the files I want to modify. The hardest part for me is seeing how KM opens each file in trn, saves and closes and does the next.

I am going to use it with FInale and Digital Performer, two music programs, I will save as MIDI, OMF, AAF - whatever's available in the menu of that program. I plan to have two macros, one for each program.

So I'd be grateful if someone would share a KM that does something like this, for example opens a folder of Photoshop files and saves each one as a PDF, or opens each WOrd document and saves it as plain text.

I can't help directly other than to ask - did you search the KM forum?

I just searched for "batch save as" and a number of hits came up that might help...
https://forum.keyboardmaestro.com/search?q=Batch%20save%20as

And whatever the actual answer is, it will be particular to the programs you're using, as you'll have to navigate the Save As dialogs in the app to pick format, etc. That makes it difficult to give generic help.

But as a general structure, you probably want something like:

Get the selection of files
For each file in the selection
—> open file in the app
—> open the Save As dialog in the app
—> edit the Save As dialog to set chosen file type
—> save and close the file
End loop

-rob.

I didn’t!

You did! The trick is to know what search terms to use and I think you nailed it...

And I am grateful since some of postings have code I can study and perhaps reuse.

Also some responses seem to facor Applescript, which I once used long ago.

I have learned my lesson: Search before Complaining!

Thanks again,

Burt

1 Like

Thanks Rob!

Will post, with thanks to you, any successful macro I can make for this!

Best,

Burt

No thanks required, that's a very simplistic outline of how I'd tackle it—and it might turn out to be entirely wrong once I got into it :).

-rob.