How to Check if all files in a folder are selected?

How can I check if all files/folders in a lister are selected?
I tried the following but it seems the syntax is not correct.

@if:Select ALL
do this
@if:else
do that

You can access that information via scripting. The TabStats information is one way to do it:

https://www.gpsoft.com.au/help/opus12/index.html#!Documents/Scripting/TabStats.htm

I couldn't use TabStats because the page doesn't offer sample codes on its usage.
Any how I was able to use the following.

    var tab = clickData.func.sourcetab;

	if (tab.Selected_files.count!=tab.files.count)
		Do this
	else
		Do that

Is there anywhere to start learning opus' scripting? some kind of tutorial or step by step guide?

thank you

There isn't an example in the manual because it's so simple. If you have a tab object, it gives you a TabStats object, and that has all the counts within it.

If you are not already familiar with JavaScript then you might find the w3Schools Tutorial useful. I certainly did when making the transition from VBScript. The Opus Scripting Objects reference is also worth getting your head around. These days pretty much any property you need to examine is defined in one of the supplied Opus objects.

1 Like

The problem with programmers is they think everyone is born programmer.

It's just like you ask me a question about 3D cad surfacing and I answer as following and expect you to understand it because it's the first thing we learn in surfacing ;

Use split points in the trim sketch, convert entities to projected curve and constrain it to 3d sketch points. Then split edges directly in the curvature.

Anyhow, I could do it in another way. Case is closed and thanks for your support.

@aussieboykie
Thanks for the advice. It's more than 10 years I haven't touched JS.
I'll do my best to catch up.
Million thanks again.

If you're new to programming then there are loads of resources on the web to learn the fundamentals.

We're here to help with the Opus side of things but teaching how to program is outside the scope of both the manual and the forum.

That said, we can and often do provide complete scripts when people need them and don't know how to make them themselves. We don't always guess correctly what someone's knowledge is or which aspect of things they need help with.

1 Like

My comment wasn't about you. I was referring to the person who had written that help page, with the assumption of because it's simple, no sample code of its usage is necessary.

A help documentation doesn't need to GUESS the level of knowledge of the reader. It assumes there MAY be visitors with a very little level of programming experience.
That's the whole purpose of a help page.
If you check MSDN pages you'll see they're thinking they are talking to a kid. Every page comes with a sample code, no matter how simple it is.

Again, I didn't mean to be rude. You've always been a great help and I really appreciate your assist and support.
My apologies if I crossed the line.

1 Like

We provide sample code that shows how to get the tab object for the active file display. That's given to you by the program itself as soon as you create a new script button. The button editor fills in a default script demonstrating various common things automatically.

(You can edit or delete that default script if you want to add your own notes, or find it just gets in the way.)

If you have a tab object and have seen the TabStats documentation I linked, and know any JavaScript or VBScript at all, then tab.selstats.SelItems to get the count of selected items should be obvious.

There are probably thousands of different pieces of information you can get via the scripting API and if we provided examples for all of them it would get a bit silly. :slight_smile: A big part of programming is reading the API docs to find out what you can get from where, and then plugging things together to get what you need.

1 Like

Thank you.