About Selecting

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