what does "findobject()" do

Discuss problems and solutions.
Post Reply
electrofux
Regular
Posts: 294
Joined: 24 Jan 2012 18:22

what does "findobject()" do

Post by electrofux »

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).
electrofux
Regular
Posts: 294
Joined: 24 Jan 2012 18:22

Re: what does "findobject()" do

Post by electrofux »

Can i access the via the getnext function selected objects functions and variables? And how is the syntax then?
Macciza
Regular
Posts: 1315
Joined: 07 Dec 2011 04:57
Location: Sydney, Australia.

Re: what does "findobject()" do

Post by Macciza »

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
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
electrofux
Regular
Posts: 294
Joined: 24 Jan 2012 18:22

Re: what does "findobject()" do

Post by electrofux »

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
Post Reply