object "script name" in javascripting
hello all,
I'm trying to access an object in a patch from javascript .
Object was not created by the script , the object have got a "script name" that can be easily adresed with a "script ...." message sent to a "thispatch" object.
What is the syntax within javascrip to adress the named object directly ?
I know I can outlet a message connected directely to the "thispatch" object but what I'm looking for is a wireless method .
The second level of my question is how to adress objects that are within a subpatch or bpatch ....
Thanks
zoomak
This question should probably be in the dedicated javascript forum but no matter. To get the maxobj of a named object and then send it a message you should try this. You might want to have a look through the javascript tutorials in the max help section too, they're quite useful.
lh
// getnamed.js
function dostuff (x,y)
{
var obj = this.patcher.getnamed(x);
obj.message(y);
}
// EOF
thank you lh,
the "getnamed" was the missing key for me .
sorry for posting in the bad forum .
I had a look a the right forum for javascripting and I have read many interresting stuffs
thanks again.
zoomak
Just an extra pointer: for non UI objects you might need to change this to:
obj.message("sendbox",somemessage);
If you open the object inspector you can drag an attribute on to your main patch and it will create a message box with the message format already in place, this will make it easy to figure out what you need to send in your js message.
lh
thank you so much lh, very helpful hint .
thank you RabidRaja,
may be I can ask another question please ....
I posted a new topic about accessing objects within a bpatcher in the javascrpit forum (I don't know how to insert here the link to that topic, sorry)
Can you have a look at it please.
Thanks in advance .
zoomak