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
Mathieu
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.
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 !
Mathieu
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 ( https://cycling74.com/forums/sharing-is-fantastick-max-multitouch-framework-for-fantastick-ipad-iphone ) is just the future of max!
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!
no, sorry, I never found a solution, and finally had to give up retrieving content of comment box.
:-(
M
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();
}
patcher_file.close();
var parsed_patcher = JSON.parse(lines);
if (parsed_patcher["patcher"]["boxes"][0]["box"]["maxclass"] === "comment")
{
post(parsed_patcher["patcher"]["boxes"][0]["box"]["text"]);post();
}