Get seleced files to the command line

DO is such an fantastic program, I can't live without it anymore. I can adapt it for so many things, it's just great.
There is currently only one thing I just can't accomplish:
When I select multiple files, how can I bring them into a commandline argument?
I made a button that should compare two files, but I can't get the file names, no matter what I do.

What I have so far is this:
"" --image-one "{filepath}" --image-two "{filepath}"

But this obviously doesn't work, because {filepath} includes all selected files, if I understand correctly. So, what I would have wished for, would be some selection like in an array, like {filepath[0]} and {filepath[1]}. But of course, this also is not possible.

So my urgent questions is: How can this be solved? How can I get individual filenames form a bunch of selected files?
Any help is appreciated! :slightly_smiling_face:

Simple way:

More advanced ways:

Thanks Leo, but I think I expressed myself a little wrongly (or I'm just plain stupid, that's also a possibility).
By "compare" I meant that a Python script ( takes two files as arguments and then compares them. And this transfer to the command line is what it's all about. I don't know how to address the marked files so that i can then specify file 1 and file 2 in the command line.
Or again more pictorial:
"" --image-one "{markedfilename1}" --image-two "{markedfilename2}"

Please forgive my ignorance, I don't know the complete script build and object naming of DO, so I'm feeling a bit lost. :blush:

Even simpler said: I want to run and give it two marked files as arguments :slightly_smiling_face:

The examples I linked to all do something similar.

So there is no possibility to use something like {filepath} but for a defined file ...?
It has to be scripted?

I would like to emphasize once again, that I can't just add the files. They must be after those --image-one and --image-two statements. That's why I need the exact named filename, not just the list.

Neither. You simply didn't read the examples Leo gave you. The two files need to be in source and destination. If you want to be able to pick files from only one file display, you'll need a script.

You can do it without a script via {allfilepath$}, which will get a list of all files selected in the source. But you need to be careful to select exactly two files if you're using that.

The simple example does that, although I'd recommend going with a script like the two more complex examples.

Scripts let you have better handling of the wrong number of selections. They also let you have a single button which works to compare two files in the same directory and or across two different directories, based on how many things are selected on each side, which is really useful.

You'll need to use scripting for that.

Yes, but how would you squeeze the --image-two switch between the files? Isn't sep= limited to one character?

1 Like

Neither. You simply didn't read the examples Leo gave you.

It would be nice if you didn't make any assumptions that you don't know about.
Of course I have looked at the examples, hence my addendum. Either it's a long script, which I'm not familiar with (yet), files are appended one after the other (like fc /b {filepath$} {filepath$}) or a tool is used for it.
As I said, script I can not and the other options are not usable (or at least I don't see how it can be used).

Well ... just so I understand this correctly:
We have {allfilepath$} where all marked files are included. We can even give these files their own separator.
And yet there is no way to access individual names in this object, as with an array?
Is this the correct way to look at it?

There is: Scripting.

While you could possibly specify --image-two as the separator (edit: that won't work anyway, see below), it isn't a good way to do things, and will still go wrong with more than 2 files selected.

If you want to do something esoteric, especially if we're taking about accessing individual array elements with custom separators between each one, then use scripting. Avoiding scripting will just waste more of your time in the end, as you'll probably end up wanting scripting for another reason soon after you solve the first step.

You can probably adapt one of the script examples I pointed to quite easily, since they're all designed to run different comparison tools on a pair of files already.

You're right, it'll only work with a single character separator, so scripting has to be used here.

I didn't know, that the try to use something that already exists is considered "esoteric".
And I didn't know, that accessing single elements from an existing object is such a big problem for DO. Maybe it would be worth considering to develop a feature that makes this possible.

Anyway, seems I have to find another way. Nevertheless, thank you for this quick response and clarification.

It sounds like you're already familiar with programming concepts, as you're talking about objects and arrays.

By "something esoteric", I mean inserting different, arbitrary strings before different items in the file list. That kind of thing is trivial to do with scripting, but difficult to do without it.

There's no reason to avoid scripting there. It is the easiest way to do what you want. And the scripts are already written for you, only needing some small modifications to make them generate the command-line your python script uses.

(You could also modify your python script to not require the special arguments, of course.)

Yes, indeed I do some web programming. But my problem is, that I have absolute no knowledge about the DO language. I haven't touched the scripting in DO yet, because it's mainly VB, which I don't know.
On the other side, I feel, that for what I would like to archive, scripting seems to be a complete overkill.
I personally create often buttons, where I do exactly what I wanted here: Giving filenames as arguments to an exe. Either video or music or whatever I require. Till now, I could always manage some way to make it work. But with this, I'm totally lost.
How easy would it be, to have some object like I mentioned, that could be used like an array. Because for my mind, it's not logical to have such an object, but no way to access the single elements in it if needed.

As I said, I never touched scripting in DO, because there was no real need for it or I found one that fitted to what I needed. So I'm completely lost, because I don't even know where to start. Unfortunately, the help pages can't really tell me what I need to know, it's very hard for me to understand.
But I guess I will find a way to start and one in, I get it done. Just not as fast as I hoped for.
Thanks again for the pointers.

I'm pretty much in the same situation as you regarding scripting, but for whatever it's worth, note that most of the scripts now seem to be in Jscript, not VB.

Not that you couldn't use VB if you knew the language, just that most people who use scripting and discuss it in the forum seem to use Jscript, so, very unexpert opinion, it's probably better to try to learn Jscript rather than VB if you are going to try to learn one or the other.

I will see. I have to find a page where all those objects are listed/named and where I can follow simple tutorials for beginners.
Haven't found anything consistent yet, but well ... I have to search further I guess.

The "Opus Manual" menu at the top right of the forum has links to the docs for all the scripting objects.

"The content is not shown because JavaScript is disabled."

Javascript is of course not disabled ...

Something is broken in your web browser, or one of its extensions.