REMOVECOLLECTIONS error

I am using a DUAL lister

I have created a button that will display all .ISO files as follows:
Find Clear=Yes FILTER "ISO Files" in C:\ D:\ S:\Software Quiet ShowResults=Source
Set Sortby=Name SortOrder=Mixed SortReverse=Off autosizecolumns

I created another button that will remove the collection as follows:
REMOVEFILECOLLECTIONS

If the source focus is not the 'Find Results' collection I receive the following error:


I would like to remove the 'Find' collection without having to set the focus to the 'Source'
Is this possible? Or is there a way to trap this error and use the 'Set Focus' = Source/Dest
Hope this makes sense.

[quote="bgregory"]I created another button that will remove the collection as follows:
REMOVEFILECOLLECTIONS[/quote]

REMOVEFILECOLLECTIONS is not a built-in command or argument. Is that a user-defined command? What does it run?

In the Command Editor, Advanced mode, click "Commands". I should have mentioned that i'm using Opus 12.4 but it was also used in 11.18 and quite possibly prior to that. I do not see the command in the 11.x manual though.

As Leo said, it's not a built-in Opus command. It may be a script or a user command you created or imported at some time in the past. Have a look in /dopusdata\Script Addins for a script with that name and /dopusdata\UserCommands for a user command.

Regards, AB

I have no idea how it got there (or as you suggested I imported it at sometime) but I did find it in the /dopusdata\UserCommands folder. It's doing a Select All, then Delete REMOVECOLLECTION. So that being the case, back to my original question, is there a way to clear the file collection without it having to be the focus?

You could do this with a script assigned to a button. Note that this sample script will delete the Find Results collection if it exists. As written you will be prompted first. If desired, you could add the QUIET option to the Delete command.

function OnClick(clickData) { var fsu = DOpus.fsutil; var tgt = fsu.resolve("/dopusdata\\Collections\\Find Results.col"); if (fsu.exists(tgt)) clickData.func.command.runcommand("Delete " + '"' + tgt + '"'); }
Regards, AB

Hmm. Looks like this approach is not quite as clean as I thought. The deletion only seems to be applied after restarting Opus. I expect the answer is to use REMOVECOLLECTION. I'll look into that when time permits or, as is more likely, Leo chips in with the correct solution. :smiley:

Regards, AB

This seems to work OK.

Go "Coll://Find Results" EXISTINGLISTER NEWTAB=findexisting [ Select ALL @confirm:Remove selected items from this collection? Delete REMOVECOLLECTION ]
Regards, AB

If you want to clear out the entire collection, you can delete the collection itself.

Delete "coll://Find Results"

Add QUIET if you don't want the confirmation prompt.

Scrap Collection toolbar has some related commands.

Thanks aussieboykie and Leo. I will give your suggestions a try. Really appreciate the help.