Accessing object attributes?
Just wondering if it’s possible to access an object’s attributes.
For example, dynamically changing the presentation rect of an object?
What I’ve figured out so far:
1.) this.patcher.getnamed("obj") returns the object within the patcher with the scripting name "obj"
2.) obj.getattr("rect") returns that object’s rect… except I don’t know if it’s the patching rect or presentation rect, and the values returned don’t match up to either one
3.) obj.getattr("Presentation Rectangle") just spits out a null object
Are there some sort of reference pages for this? Somewhere that actually lists the corresponding tokens to pass to getattr()? It’d really take the guess work out of the equation.
EDIT: getattr("presentation_rect") correctly returns the presentation rect.
It seems getting attributes is a piece of cake as long as you know the token to pass getattr.
Setting attributes, however…. No amount of google searches has answered this for me yet.
Starting to believe that this feature doesn’t exist?
This works for me
----------begin_max5_patcher---------- 363.3ocmSF1aBBCDF9yvuhll8Q2BkHQcea+NLFSAtgcCtRZqItY7+9nsXAm5 lZBoEd6cbu2CG6iin4xcflRdkrjDEsONJxIYEh5eNh1v2UTy0tvn31lbPQm3 O5cIZzhuA6QrzWR5k6BRf0fwkBaPTt0bTMsW0KY9pE7tfJPCcBglywJJYUeT sbSwFAVsVAEFefSmmzUOxrL6Zl69zt0PJhRmek4e77zw1E4MtRQeSI30zPAT c5FPsFPddsKhD6QGhisKStQ7z.ZMuBN9ZMvNmcosJPCngaDRz0DjmXgq6glo WjlrqQy+AgyrXiktvsMyAQ17KCwz+.hO.nZ4HDn+EmWDUnryq0hhOGKeFI88 Bap28muEZlSQVx04RFym8hLOdlG1Fn4HWbhoG.FaLVbIRqE3u+ayUdq9orRK 2pJN9QreFlLT9RPaDXn5KCehFEyFQYIfia0Rg1NaWd8g6a0Mo2faXOnaHqhO D+CUxGwb -----------end_max5_patcher-----------
I’d hate to write an entire "connection manager" system, just to change a few object attributes.
i have the same problem. i want to read out the messege inside of a messege box with this code.
inlets = 1;
outlets = 2;
var Liste = this.patcher.getnamed("message");
var arr = Liste.getvalueof();
the message box has the scriptingname "mesage" and i sent the message "liste" to my js object, but i get jsobject 0 on outlet 1.
i didnt figure out where the failure is. any suggestions?
yourObjHandle.message("presentation_rect", 20, 20, 20, 20);
You could also adress object attributes by their scripting name (you have to specify the scripting name in the inspector at patcher level):
h_obj = this.patcher.getnamed("yourObjVarname");
if (!h_obj) post("Error: patcher does not contain an obj with scripting name yourObjVarname");