About Selecting

[quote="zhgwangff"]Thank you very much for your kindly answer,
so these are mission imposible for Dopus now, I hope see it as soon as posible.[/quote]
You got two answers for the "deselect all files with a same extension" one so that one is possible at least.

I don't know if the flat-view path select/deselect one is possible, though. I vaguely remember filing a feature request along those lines recently but I might be thinking of something slightly different. For now I would resort to range (de)selection using the mouse. Or use the Find Panel instead of Flat View, in which case you can refine your search criteria to exclude certain folders and then re-run the Find.

[quote="leo"][quote="zhgwangff"]Thank you very much for your kindly answer,
so these are mission imposible for Dopus now, I hope see it as soon as posible.[/quote]
You got two answers for the "deselect all files with a same extension" one so that one is possible at least.

I don't know if the flat-view path select/deselect one is possible, though. I vaguely remember filing a feature request along those lines recently but I might be thinking of something slightly different. For now I would resort to range (de)selection using the mouse. Or use the Find Panel instead of Flat View, in which case you can refine your search criteria to exclude certain folders and then re-run the Find.[/quote]

what i exactly need is: i.e. you have all files selected, and you want to deselect all *.doc files. I know you can use the command "deselect *.doc" itself, but it would be better, if just deselect anyone of the *.doc files ,and then press a command "deselect all files with the same extention of the deselected file", espesially in case when you need deselect several kinds of files at a same time.

What's wrong with something like what Christiaan suggested?

Select DESELECT "*.{dlgstring|Enter extension to deselect}"

With that you click the button, type doc and hit return. It would then deselect all .doc files.

Found a way to do it without a dialog !!!

Step 1: deselect a file (for example with the extension .bmp)

Step 2: Click this button:

Select INVERT Select PATTERN *{f|ext} Select INVERT

Now, all files with the same extension will be deselected 'automatically'.

@ Leo: Why doesn't this work:

Select Invert
Select SIMILAR
select invert

[quote="Christiaan"]Found a way to do it without a dialog !!!

Step 1: deselect a file (for example with the extension .bmp)

Step 2: Click this button:

Select INVERT Select PATTERN *{f|ext} Select INVERT

Now, all files with the same extension will be deselected 'automatically'.[/quote]

Its just wonderful, how did you think it out? Thank you very much

[quote="Christiaan"]Select INVERT
Select PATTERN *{f|ext}
Select INVERT[/quote]
For me that seems to deselect everything no matter what is selected/deselected to start with.

I tried this several times! It works perfectly here ... :confused: This is exactly what zhgwangff and I are doing:

Select everything (CTRL-A) -> Deselect one file (for example picture.bmp) -> click my button:
It inverts the selection -> picture.bmp is selected -> it selects every file with the extension .bmp ->
it inverts the selection -> all the .bmp files are deselected (and all the other files are selected) ...

But, as i mentioned above, the code with Select SIMILAR doesn't work, i don't know why.
That's why i used Select PATTERN *{f|ext}

See also: [Select all files matching selected file's extension)

That button only works the way you intend if there are no folders at the top of the list - perhaps that's why it doesn't work for Leo.

Ah, seems like the button has two problems which affected both of the folders I tested it in:

  1. If there are any folders then everything is deselected (as Steve just said).

  2. If there are no folders, but only one type of file, then everything is deselected even if everything was selected to start with.

quote="Christiaan"
@ Leo: Why doesn't this work:

Select Invert
Select SIMILAR
select invert[/quote]

I think this is another bug in Select command. Check the follow code instead:

Select Invert
dopusrt /cmd Select SIMILAR
select invert

[quote="leo"]1) If there are any folders then everything is deselected (as Steve just said).
[/quote]

Really no problem here! Tested it again, very strange ... :confused:

Do you mean, for example, a folder with only .doc files? When you select all the .doc files, deselect one of them and click the button, OF COURSE everything is deselected (the button should do that: it deselects all the .doc files and there are only .doc files). But: the button isn't useful in that situation! If you want to deselect all the .doc files in a folder with only .doc files, just deselect them ...

My 1st problem:

Since {f|ext} turns into an empty string for folders (or files for that matter; anything with no . in its name), won't you end up running this:

[ul][li]Select INVERT[/li]
[li]Select PATTERN *[/li]
[li](maybe select some other things as well, but everything is already selected at this point)[/li]
[li]Select INVERT[/li][/ul]

So that will select everything and then invert the selection, in effect deselecting everything.

BTW, are you using a normal button type, or is it an MS-DOS button or something? Maybe that is a factor.

My 2nd problem:

I'm not deselecting any of them.

I have a folder with only .doc files and they are all selected. I click the button the result is that they are all deselected.

I don't know exactly what's going on or why you see different results to me, though.

Below a screenshot of my test folder. I selected all the files and folders, then i deselected one .bmp file and than executed the code: You can see the results: only .bmp files deselected. So, it works ok here with folders on top of the list.

And again: the 2nd problem isn't a situation where the button is useful! It works ok there because you didn't deselect one of the files. And when you deselect one of the files, they are all deselected, because they are all .doc files! It's not an error! :wink:


Try it without any folders selected. You should find the button always deselects everything. So you can't use it when there are folders present, unless you select them all first.

(Maybe that could be worked around by (de)selecting everything without a . first in the button. And/or maybe using TYPE=files with some of the lines, but I'm not sure...)

I know, but even if it isn't useful in that situation, that it does the opposite of what it should do suggests it may have some other unwanted behaviour as well. Better to find that, or at least fully understand what's happening, before relying on the button, I think.

It doesn't work okay; it deselects everything when everything is selected. If it's only meant to deselect the extensions that are not (completely) selected then it shouldn't do anything if all files are selected.

Of course, if that is the only situation where it goes wrong then it's okay. But, as I said, I would be worried that there are other situations we haven't thought of where it also goes wrong.

Yes, that behaviour is fine. My problem is what that the button deselects everything in cases where it shouldn't do anything.

It works well on my computer, have no idea with what Leo said

Try it without any folders selected. You should find the button always deselects everything. So you can't use it when there are folders present, unless you select them all first.

(Maybe that could be worked around by (de)selecting everything without a . first in the button. And/or maybe using TYPE=files with some of the lines, but I'm not sure...)

I know, but even if it isn't useful in that situation, that it does the opposite of what it should do suggests it may have some other unwanted behaviour as well. Better to find that, or at least fully understand what's happening, before relying on the button, I think.

It doesn't work okay; it deselects everything when everything is selected. If it's only meant to deselect the extensions that are not (completely) selected then it shouldn't do anything if all files are selected.

Of course, if that is the only situation where it goes wrong then it's okay. But, as I said, I would be worried that there are other situations we haven't thought of where it also goes wrong.

Yes, that behaviour is fine. My problem is what that the button deselects everything in cases where it shouldn't do anything.[/quote]

Ok, now i can reproduce the 1st error:

error 1. If there are any folders AND they are not (also) selected, then everything is deselected

Perhaps something like this could solve the problem:

Select INVERT Select DESELECT ALLDIRS Select PATTERN *{f|ext} Select INVERT Select DESELECT ALLDIRS

But the last Select DESELECT ALLDIRS is not really necessary, i think.

error 2 If there are no folders, but only one type of file, then everything is deselected

This is not a very important error for now, i think ...

FWIW, error 2 also happens if there are multiple types of files and they're all selected.

Hmm... Maybe this is the explanation:

<guess mode on!>

{f} tells Opus the button needs (not wants) a file. If Opus sees an {f} code in a button and nothing is selected then it won't run the button at all. However, when the button starts to run things are selected so the check succeeds. The first line then deselects everything and {f} code on the second line has no files to work with so it emits a blank (like the {f!} code which wants (not needs) a file.

In other words, the "are there files to satisfy the {f} code?" check is done before the button is run and not before each line of the button. Usually there is no difference when the check is done but in this unusual case where the button changes the selection and then uses {f} there is a difference.

If my guess about what's happening is right then, yeah, there's nothing to worry about since it won't affect other situations.

[quote="leo"]FWIW, error 2 also happens if there are multiple types of files and they're all selected.

Hmm... Maybe this is the explanation:

<guess mode on!>

{f} tells Opus the button needs (not wants) a file. If Opus sees an {f} code in a button and nothing is selected then it won't run the button at all. However, when the button starts to run things are selected so the check succeeds. The first line then deselects everything and {f} code on the second line has no files to work with so it emits a blank (like the {f!} code which wants (not needs) a file.

In other words, the "are there files to satisfy the {f} code?" check is done before the button is run and not before each line of the button. Usually there is no difference when the check is done but in this unusual case where the button changes the selection and then uses {f} there is a difference.

If my guess about what's happening is right then, yeah, there's nothing to worry about since it won't affect other situations.[/quote]

Maybe its nonsense, but I imagine, if we can treat all folders like "files with no extensions" , these coulde be resolved. I dont know if this is avalible in Dopus.

What about adding @filesonly to the button?

Error 1 Can be solved by adding Select DESELECT ALLDIRS , as i wrote above:

Select INVERT Select DESELECT ALLDIRS Select PATTERN *{f|ext} Select INVERT Select DESELECT ALLDIRS

BUT: A better (and shorter) way is to use @filesonly, thanks Jon! :slight_smile:

@filesonly Select INVERT Select PATTERN *{f|ext} Select INVERT