Help writing button to run ImageMagick via Windows Terminal

Currently on windows terminal executing the code below creates a pdf file at the current directory (I have imagemagick in my path)

magick.exe myimage.jpg mypdffile.pdf

I am trying to create a button in opus that does the same thing. On the current lister if a file is selected, using imagemagick execute the following;

magick.exe {filepath$} mypdffile.pdf

I am stuck on trying to open windows terminal, On the docs Here, I only see options for CMD and Powershell. How can I use windows terminal?

When trying to call command line programs for Opus use, In the function drop down menu, should standard function (Opus or external) be used or MS-DOS Batch Function?

This would help me allot in how to go about this in the future, thanks allot.

Do you want/need Windows Terminal for this specifically, or do you just want to run the command? The command doesn't need to run in Windows Terminal and should work as-is.

If you do need Windows Terminal, I think it has a command line that lets you tell it what to run, but I haven't used it much.

If not, the command will work in both Standard Function mode and MS-DOS Batch Function mode. The main difference is whether a Command Prompt window opens to show any output from the program.

If you want the Command Prompt and want it to stay open, use MS-DOS Batch Function, and add the pause command at the end. (Or add a line with @leavedoswindowopen at the start.)

You may also need to add a line with cd {sourcepath$} before you run the command, to make sure it runs with the correct current folder. (That or specify the a full path for the output file, not just a filename. Although it depends how magick.exe works and if it automatically uses the same folder as the source file.)

Thanks for the thorough explanation Leo.
Your explanation should do just fine with Imagemagick. Its too late into the night to test it now.

The reason why I want Terminal is there are times when I want opus to start a process and then leave it for me take it from there and for these cases I would like to use Terminal as I have configured it allot in terms of aliases, colours, hotkeys etc.

I do have a button here that launches windows terminal from the current source path

wt -d "{sourcepath|noterm}"

I tried replacing wt-d in place of CLI DOSPROMPT=powershell like so but it just launches regular CMD prompt:

CLI DOSPROMPT=wt-d

trying this in a button opens successfully opens terminal:

wt

Hmmm...

I will ask around over at stackoverflow and other places this weekend and see how it goes, I'll report back for anyone else.

Opus supports the environment variable %ComSpec% which lets you specify an alternative batch file processor (i.e. other than cmd.exe). I'm not sure if WT would work with that or not but it might be worth a try.

1 Like

Okay I will give that go after. thank you.