find named object and send it a message

May 2, 2009 at 8:51pm

find named object and send it a message

I’m looking at some of the patcher scripting stuff in the api. iterator.c is a good guide, but I do want to check if there’s a simple method similar to “getnamed” in javascript, such that I don’t have to iterate through all the boxes in a patcher.
Something along the lines of

t_object *desiredobject = jpatcher_get_namedobject(“scriptedname”);

and you could then just pass desiredobject into the various jbox goodies.


May 3, 2009 at 4:08pm

Hey Peter,

You can do something like that:

t_max_err err;
t_object *patcher = NULL;
t_object *yourobject = NULL;

// get the patcher
err = object_obex_lookup(yourobjectpointer, gensym("#P"), &patcher);

// get the object that you're looking for.
yourobject = (t_object *)object_method(patcher, gensym("getnamedbox"), gensym("theobjectname"));
May 3, 2009 at 5:20pm

Great! Thanks EJ.



You must be logged in to reply to this topic.