get comment or message box content within a js ?

Aug 21, 2010 at 9:01am

get comment or message box content within a js ?

I would need to get (and set) the content of (named) comment and message box within a js.
is it possible ?
couldn’t find info about it in the doc.
any help is very welcome !

thanks in advance


Aug 22, 2010 at 3:47pm

Setting is as easy as sending a message to the named object with the set or message functions, but retrieving the current information is much more difficult. One idea is to script a [grab] object into place and connect it to a [message] box and back to a dedicated inlet of your [js] object. If you only need this to work in a patching environment you can even parse the JSON text of your patch as demonstrated in this article. However this won’t work with anything other than a maxpat file so if you need it to function in a standalone application this method will not work.

Aug 24, 2010 at 8:11am

Thanks Luke for your reply.
unfortunately, this won’t help me much, because i need to get the content of a comment box, and grab can’t get it ; (and my js isn’t in the same patch…)
ok, I’ll find a workaround !

thanks !


Sep 2, 2010 at 8:56am

I think you might ask C74 directly, and they should really adapt a bit max objects to your goals in next incremental max version, come on!, what you’re working on ( ) is just the future of max!

Sep 13, 2013 at 12:30pm

Mathieu, did you ever resolve this issue? I am trying to do something similar, retrieving the text of a comment box with JS. Any info of your process or solution would be appreciated!

Sep 14, 2013 at 2:15am

no, sorry, I never found a solution, and finally had to give up retrieving content of comment box.


Sep 14, 2013 at 8:38am

One way to do this is to load up the patcher as JSON and then parse it for comment boxes.

Please excuse the roughly hacked out code – hopefully you will get the idea

var patcher_file = new File(this.patcher.filepath);
while (patcher_file.position != patcher_file.eof)
lines += patcher_file.readline();
var parsed_patcher = JSON.parse(lines);
if (parsed_patcher["patcher"]["boxes"][0]["box"]["maxclass"] === "comment")


You must be logged in to reply to this topic.