Thank you. This works well. However, it does pop up a command window for every conversion. Is there a way to repress the command window from popping up?
I guess my next question would be - instead of selecting all files in a folder, it would be nice to be able to select 10 parent folders, and have the script run for every file inside of the folder recursively. Possible?
Generally, you want to interact with DO and its API as little as possible. The way to go is to read minimum amount of information you need from DO (like selected folder(s)), do all the stuff in python and then just set/create elements specific to DO (like open a tab, save layout etc).
Anything else is easier and better done in python, including things like metadata manipulation, image conversions etc etc.
In your case, you just read from DO selected folders (or have them passed as parameters, as above) and then use os.walk or Path.glob to traverse directory trees doing your stuff with files.