Select Filter via VBScript

While experimenting with a recently added sample script I observed a problem which has now been tested and confirmed in a virtual machine with Opus v11.4.3 64-bit. I used this simplified code in a script button..

Function OnClick(ByRef ClickData) ClickData.Func.Command.RunCommand("Select Filter TestFilter") End Function
Running it once selects matching items. Running it a second time, everything is deselected. This pattern continues - executing a 3rd time selects, executing a 4th time deselects, etc..

A simple Select Filter TestFilter command in a normal button consistently selects matching items on every execution.

Regards, AB

If you want to keep the selection after the script is done, then add:


Ah, OK. That gives a clue as to what is happening. The underlying internal logic appears to be...

[ol][li]Make a list of all currently selected items.[/li]
[li]Execute the filter to add to the current selection.[/li]
[li]Deselect the originally selected items.[/li][/ol]
If there is an overlap between the originally selected items and the items selected by the filter, then things go awry. Specifying deselect=false prevents step (3) from being executed.

Regards, AB