Troubleshooting

what does "findobject()" do

Started by electrofux on .

Sign in or create an account to join the conversation.

4 posts

Topic starter
The manual says the findobject(name) function "selects an Object within a tree structure (project,interface or container)".

What does that mean, what can you do with a found and selected object?

Same goes for getnext(object).
Hi
There are a few different examples of there use in the manual . . .
And I guess a few different ways of using them as well . . .

One basic option is iteration - doing something with a whole bunch of objects . . .
See the 'while' loop example in the manual for one use case . . .
You can also setup arrays of object names and step through it in a 'for' loop finding each object doing something and then again for the next 'i' in the list

decl target = {'something','something','etc'};
decl n = sizeof(target);
decl obj;
decl i;
for(i = 0; i < n; i++){
obj = findobject(target);
setattribute(obj,'color',RGB(1,0,0));
}

Or if you have a bunch of Faders in a Container you could find the container getfirst fader then getnext each following obj . . .

Keep your eye out for there use in others code - and see how they are using it
Hope that helps
MM
Woot, it works like i was hoping. I can use the setexpression function to trigger an object that i can only reference by name.

I had a hard time accessing the different 64 Pads of the Pushscale template because they were not in an array. But now i can make an array of the Padnames and then count through.

Incoming selectable Chords for that template :D

Thx