Hello,
On one of the example scripts an Enumerator is invoked. What is the difference between using that and storing the values in a object?
Thanks
Hello,
On one of the example scripts an Enumerator is invoked. What is the difference between using that and storing the values in a object?
Thanks
Not sure I understand the question. An enumerator is an object.
I meant that what was the reason to place the object inside an Enumerator function,
new Enumerator(clickData.func.sourcetab.files)
Instead of simply stating the object alone
clickData.func.sourcetab.files
No technical necessity, I'd say. Just as a demonstration or out of habit.
This would work just as well:
for (var i = 0; i < clickData.func.sourcetab.files.count; ++i) {
var item = clickData.func.sourcetab.files(i);
DOpus.Output(item);
}
Not all objects have a count
property, in these cases wrapping the object in an enumerator is mandatory.
OK, breaking the function down does help. I still have to look up some of the other terms in the code, but you have helped me understand it better already thanks.
I don't see a count property under Item in the manual, yet if I test the statement out in a script, it works fine, is count a universal property?
files(i) has a parentheses like it is a method with arguments, but I don't see a method under Tab either?
You mean where files.count
is being called?
files
is not an item
object, it's a collection of them.
What is the difference? Does a collection of objects cease being an object itself? Do collections have their own set of properties?
Collections are objects, but they are not the same type of object that they contain (unless you have a collection of other collections or something like that).
Consider of a basket of tennis balls. The basket is an object. Each tennis ball is also an object. But is the basket itself a tennis ball? No. The basket is something with different properties, and which does different things, compared to the objects it contains.
You can count the number of items in a basket. You cannot count the number of items in a tennis ball because tennis balls don't contain other items.
It makes more sense now
Since I can count where would I find a list of other "properties" (not sure exactly what I would call it) that sourcetab
calls. I presume the same logic applies to files(i)
, "()" being a function of the collection. I don't know the correct terms, so I can try to explain in a different way if necessary.
The properties and methods of all objects defined by Opus itself are in the Reference section of the manual.
Collections are not something defined by Opus; they are part of the larger ActiveScripting (VBScript and JScript) whole defined by Microsoft.