Can I get all object's properties as JSON in stand-alone

    Jun 16 2021 | 10:05 pm
    Hi all,
    I'm making stand-alone application. In this application, the user can create some objects (encoders, sliders...). I want to be able to save and reopen this as a file. So the user could open (and use) his "preset" (with the encoders, sliders...), he had created.
    How to do this, please? Thanks in advance.

    • Jun 17 2021 | 8:54 am
      How would user crete objects in locked max -standalone patch ? probably using scripting. So you just need to store the scripts as text or whatever and read, load - execute them in the standalone
    • Jun 17 2021 | 9:30 am
      Thank you for your reply. Yes, the objects are created by using javascript.
      The question is, how can I get all necessary data of the object (position, size, all attributes, etc.), so I can store them. Of course, I can ask every single object for the attributes "manually" one by one. But I was thinking, there is a direct way. The object is described by JSON in Max already. So my question is, how to save this JSON of the object and save/reload it.
      Something like var mySliderAttributes =
      Thank you
    • Jun 17 2021 | 9:47 am
      If you create objects using scripting, then you also need to specify size and position of objects to create.So use that info and store it.
    • Jun 17 2021 | 9:52 am
      Yes, I know. But then I can allow the user to change the position, resize the object, change the attributes. I would need to track it all the time. I think, it would be much easier to ask the object for all attributes at once, at the moment, when the user is going to save his preset. Is this possible, please?
      Thank you
    • Jun 17 2021 | 10:05 am
      I have no idea, not really interested in such thing. Maybe someone else could help you.
    • Jul 05 2021 | 10:05 pm
      Hi Martin,
      I was curious when I read this question, and had a quick look, I think you could do it with pattrstorage and autopattr, I tested it a bit with the javascriptscripting patch and when you create the sliders in the patch they will be added to the storage. Then you write the storage to json, which you load into a dict so you can read the dict out with javascript to create the objects again when the user loads the app. I have not tested it yet nor wrote a JS script to read and create the objects, ( I just started to noodle around with N4M and JS, so not have a finished solution there. But have a look at the attached patch and play around by creating the objects )
      also there is the example of the patchdescribe.js which might be also helpful>?
      Also now I think of it. If you just want to recreate the objects write the created objects to another dict object that you read when you load, but I think the pattrstorage and autopattr method might be what you are looking for..
      I am curious if you find something that works. Also I will have a go at it.
      I think by reading a json file with objects and values you should be able to recreate them when a user is loading a preset.
      Kind regards