Passing commandlines to external program

There is program named QueueRun.exe that tries to solve problem described here Running a given number of functions at once.
Its syntaxt is:
QueueRun.exe JobList.txt THREADS=0

where JoblList.txt is text file containing commandlines (one commandline per line)
and THREADS/K is optional parameter, by default equal to number of logical CPUs.

I wonder whether there is method of dumping commandlines for all selected files to JobList.txt and then run "QueueRun.exe JobList.txt", instead executing them.

For example currently I have context menu entry "ebook-convert.exe {filepath$} {filepath$|ext=mobi}" for RTF files.
My goal is function that would create JoblList.txt containing text like:

ebook-convert.exe "D:\Ebooks\Somefile1.rtf" "D:\Ebooks\Somefile1.mobi"
ebook-convert.exe "D:\Ebooks\Somefile2.rtf" "D:\Ebooks\Somefile2.mobi"
ebook-convert.exe "D:\Ebooks\Somefile3.rtf" "D:\Ebooks\Somefile3.mobi"
...
ebook-convert.exe "D:\Ebooks\Somefile100.rtf" "D:\Ebooks\Somefile100.mobi"

and then execute QueueRun.exe JobList.txt

Any idea?

Take a look at this
gvlt.wordpress.com/2013/01/02/ba ... g-calibre/

I think you could modify this slightly to convert rtf to mobi.

Thanks.
I know alternatives to ebook-convert.exe (Calibre main program has its own internal queue of tasks, usable in conversion).

ebook-convert.exe is just example that may be replaced by any other CLI program.
Function I am searching for (and QueueRun.exe) would not be (is not) limited to ebook-convert.exe.

You can use an MS-DOS Batch Mode script to redirect the output from the echo command to a text file, building up the list of commands to run and then run QueueRun.exe on them. (Slightly similar example here, if you're familiar with DOS command redirection.)

Or you can use something like {filepath|filem} to have Opus generate a text file listing all the filenames, and then pass that to an external tool or script which processes the names into the format which QueueRun.exe requires.

Make a button to run the following in "MS-DOS Batch Function" mode.

del /q JobList.txt
echo ebook-convert.exe {f} {f|ext=mobi}>>JobList.txt
start QueueRun.exe JobList.txt

Thanks for hints.

I would automate your need with a simple AutoHotkey script.

Do you mean replacing QueueRun.exe with AutoHotkey script, or replacing only function that create JobList.txt?
First would be really interesting, second... only interesting.

As you like. You can either create lists to a text file or run tasks on lists of files or pretty much anything you need to automate on a computer.

If it is not big effort, please explain both.

Something likeLoop, *.rtf { FileAppend, %A_LoopFileName%, JobList.txt }orLoop, *.rtf { SplitPath, A_LoopFileName, , , , noext RunWait, ebook-convert.exe %A_LoopFileName% %noext%.mobi }Now I leave it up to you

@mar_d, I will comment from bottom to top.
The second example will execute either all or just one thread at time. There's completely no need to use Autohotkey as it does not introduce anything new.
The first example let's you create a list of tasks for QueueRun but I can't really see why it's better than the ms-dos batch function mentioned few posts above. (Unless you want to read all *.rtf files from one or more arbitrary (always the same) folders -- as opposed to reading all or selected files from folder currently viewed in DOpus -- then it might be easier using Autohotkey.)

They were minimalist examples written in a minute to get Konrad started with AHK scripts. It's a new way because he doesn't want to use QueueRun. You can expand them to meet any particular needs.
But this is beyond the scope of this forum, so I stop here. Take or leave it, it's up to you.

I agree with daroc.
Both scripts are not equivalent for QueueRun.exe and function that call it and provide with argument.
And first seems to only add complexity by adding AHK to business.

@mark_d
Thanks for calling attention to AHK.
But frankly speaking I had hope on simple (as promised :slight_smile: ) scripts that would replace QueueRun.exe and its DOpus infrastructure.
For minimalist needs QueueRun.exe (or equivalent) is not necessary. :wink:

[quote="mark_d"]They were minimalist examples written in a minute to get Konrad started with AHK scripts. It's a new way because he doesn't want to use QueueRun. You can expand them to meet any particular needs.
But this is beyond the scope of this forum, so I stop here. Take or leave it, it's up to you.[/quote]
I understand that you don't want to write complete application that would work similar to QueueRun as it might be quite complicated and you would probably end up with long list of TODO list provided by users who may want to use you app.

Anyway, your previous posts ("I would automate your need with a simple AutoHotkey script.") looked like you wanted to write simple but working similar to QueueRun application (so eg. it does run only n tasks at time but doesn't have any options/parameters). This is why I commented your code snippets that they don't provide anything new to what you already can do with DOpus functions.