Once in a while... Or: A wish for the future: console.log()
Once in a while there is Max6 mentioned aleady. And once in a while people post what they are missing in Max/MSP.
And not just once i a while but right now I realize how great it would be to have a JavaScript object for debugging like the "console" object in Chrome and Firefox(Firebug).
Just typing console.log(anObjectorArray) and seing in the Max windows it's content!!!!
I halfheartedly second the desire. There are other javascript additions that I 'give this up' for.
You can use something like this if you like. You can even add these kinds of functions to a global js file put in the js-extensions folder.
var foo = new Object();
foo.one = "test";
foo.two = 74;
foo.three = [9,10,11];
foo.bar = new Object();
foo.bar.bozo = "i'm not a clown";
myobjectprinter(foo,"foo");
function myobjectprinter (obj, name)
{
if (( typeof obj == "number") || (typeof obj == "string") ) {
post( name + " :" + obj + "n");
} else {
for(var k in obj){
if (obj[k] && typeof obj[k] == "object")
{
myobjectprinter(obj[k], name + "[" + k + "]");
} else {
post(name + "[" + k + "] : " + obj[k] +"n")
}
}
}
}
global js file in jsextensions? I apologize if this is somewhere else, but could you please explain what you mean? it sounds like i I could have a bit of code in jsextensions and call code in it. would I need to 'include' the jsextension somehow?
Check out the Cycling '74/jsextensions folder. When you launch any JS object, all the files in this folder are loaded and added to the global context, so you can create new classes or functions that can be used anywhere. You don't need to include it explicitly, it is included.
Have fun.
-Joshua
Yeah, I poked around and figured it out. the .mxo files are interesting. I felt like i found waldo when I saw LiveAPI. This folder is great for personal patches, and only slightly less great for patches I want to share.
Many thanks!
One question about jsextensions: it seems that once the folder has been read, any changes to files therein do not take effect until Max is restarted.
Is there any way to cajole Max into re-reading the directory?