Is it possible to add commands to a queue?

I've created a button on a toolbar that merges two files together with mkvmerge (thanks to another topic found elsewhere on this forum) - works great, but what would make it even better is if I could run the command for different file selections and have them added to a "command queue" (similar to the file copy queue) rather than running immediately.

i.e. wait for the other command to exit before starting the next one.

Is this possible?

You could do it using scripting, but there's nothing built-in for that (unless all the items are selected at once, of course).

Building up a list of the files you want to work on in a collection and then running a command on everything at once is an easier way to do things, but of course means you can't add things after it starts, and can't use the time while you're selecting everything to start on the first items.

You could echo the mkvmerge commands into a batch file instead of running them directly.

How can i add commands to a queue using scripting ?

The queue is only for copy/move, isn't ?

Not the actual copy queue. A script could make a queue system of its own. (Scripts run whatever code you want, so they can do just about anything. Whether it's worth your time to write something complex when there are other options like using a collection is another matter, of course. Depends on your needs.)

I've created a (very) basic Windows application that can handle this stuff for me - https://www.gazchap.com/cmdqueue/

It's open-source, link to GitHub repository is on that page. I don't really do an awful lot with C# or .NET so it's probably awful, but it works for me.

Your mileage may vary, and I can't take any responsibility if anything goes wrong with it and you bugger up your computer, but it works perfectly for my use case, namely a toolbar button with this script on it:

@disablenosel
@runmode:hide
@firstfileonly
"CmdQueue.exe" /START /NAME "MKVMerge - {destpath}{file|noext}.mkv" /ADD "C:\Program Files\MKVToolNix\mkvmerge.exe" --default-language eng -o "{destpath}{file|noext}.mkv" {allfilepath$}

So now, whenever I click the button, it adds the mkvmerge command with the relevant arguments into the CmdQueue queue, and then starts the queue running (if it isn't already)

1 Like