Hi, I'm sure this is something really basic (but it's my first time). I'm just trying to create a new custom action that sends the selected file(s) to an external command line utility. And it's not working.
So I created a new command, Standard Function. It's a one liner. "magick convert -quality 95 {file} {file|noext}.jpg". Easy peasy right? Convert a file to a JPG. Give it the same name, but the extension should be .jpg.
Then I went into the File Types editor, Images file type group, Context Menu, New, Standard Function, and then just the name of my custom command "makejpg".
Unfortunately it doesn't work. How can I fix this, and/or, enable some kind of debug logging so I can see the output behind the scenes and understand what I'm doing wrong?
If magick is a command line tool, change the command type from Standard Function to MS-DOS Batch Function, which will display any output from the command when it runs.
You can also add @leavedoswindowopen to make the window stay open after the command finishes, to give you a chance to read any error messages.
Thanks, the MS-DOS thing made it work. Another question- when selecting multiple files and launching the command, is it possible to make it launch the command on all selected files simultaneously? Seems like what it's doing now is launching it for each file one at a time sequentially, and waiting ~1 second before launching the next one. Would be nice to use this 12-core CPU I have just waiting around....
Magick couldn't find the files. Use {filepath} instead of {file}.
No need to use DOS mode. Both modes make Magick use all cores, but Standard Function seems to be a bit faster, judging from a quick test (Win11, ImageMagick-7.1.0).
Actually, {file} works fine. No need for {filepath}
Actually, "MS-DOS Batch Function" is the only one out of the four available function types that seems to work. It might be that the other types require additional syntax to run an external command, and I'm kind of a beginner here. Unfortunately it definitely does not use all cores, and definitely runs the commands sequentially like I described. (It also pops up a command.com window, which is kind of unsightly.)
So my question remains: how do I configure this custom command so that it a) uses all cores / runs on all files simultaneously when multiple files are selected? And b) how can I hide the MS-DOS window, that would be nice too.
{file) will only work if the command has changed its current directory to where the files are. The CD is set to System32 by default ss it is more secure to run things that way (avoids DLL planting exploits in Windows). Using full paths instead of just names is recommended and also means your button will work in situations like Find Results and Flat View where the files may sll be in different folders.
How many cores are used is up to the program being run. Opus will not run things in parallel automatically. It can run everything in parallel without waiting but then there’s no limit on how many things run at once.
See the @runmode modifier for how to hide DOS windows.
If you use that it won’t wait for the commands to complete but it’ll also be unbounded. If you do something that runs the command once on 1000 files then they’ll all run simultaneously, which may not be what you want, if you were expecting one command per CPU core or thread.