find named object and send it a message


    May 02 2009 | 8:51 pm
    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.
    P.

    • May 03 2009 | 4:08 pm
      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 03 2009 | 5:20 pm
      Great! Thanks EJ.
      Peter