Clipboard COPYNAMES breaks execution if nothing selected

When using "Clipboard COPYNAMES" in a button that contains additional commands, the button will stop executing once it reaches the Clipboard command, if there are no items selected.

I was able to get around this by using SelectEx, which I coincidentally tweaked recently to feature a NOFAIL switch (similar problem/implementation here). Maybe something like that is useful for various native commands as well, just to make them more flexible (also when used in scripts).

Thanks for reading. o)

It needs files and fails if there are none. It's by probably design, although I'm slightly surprised the button is running at all (unless files are selected at the start, then de-selected during the button, or there's a Select command in there somewhere). [Edit: I see from the other thread that this is probably the case.]

Of course, you can take complete control over which commands get run on which files and what (if anything) happens if they fail by running the commands via scripting. (Or modifying the clipboard via scripting, if it's easier. May depend on the exact aim.)

Uh oh, the "s" word again :slight_smile:

Nothing against the "s" word! o) I intentionally mentioned scripting, because I think the problem remains. A batch of commands in a Command object will also fail execution for no items, the same applies to the command Delete and probably others. Also worth mentioning: Using "Clipboard COPY" does not break execution (hu?).

You can get around that by only "AddLining" the command if items have been added. But if you also plan to use "Delete", you need another condition. Now you may end up with an empty Command object, in which case you need another condition to not run cmd.Run(), because it's going to throw an exception.

I guess some of these things derive from handling buttons-old and I surely exaggerate a bit, but you may get my point. I think doing just nothing or letting upcoming commands run in these situations is as intuitive as it can get. I assume, so is adding a switch to force behaviour or adding notes to the docs. It can be extra challenging to make use of "s", with specifics from buttons-old mixing in.