Defaults in standalone
Hello there,
Can anyone recommend a way to have user defaults stored in a standalone application. The situation would be that users would change a value and have the option to save it into the application. I want it to be as invisible as possible, so that the user only would need to, say, click a "Save" button. I'm open to any suggestions whatsoever! Ideally, I don't want to use an external file for the defaults (otherwise I could just use Text, Preset, Coll, Table etc.) But I'd like to have it stored within the standalone.
Best regards,
James
Have a look at the [preset] and [pattr] family objects. There are some good tutorials included with max that can explain them. [pattr] will save an xml file, but if you hide this in your standalone the user need never see it. You can even use [preset] to store and recall states from your [pattr] objects. It can be a bit hard to get your head around but it's extremely effective, you can even morph between one (or more!) presets this way. Have a look at Chris Muir's pattrkitty example at the link below, it's a good example of how to set up a simple [pattr]-based system.
lh
Thanks lh! I'll check out the pattr object. I glanced at it briefly but didn't think it would work for standalones. I'll definitely check this out.
How would one go about storing the XML file in the patcher? I noticed that the Muir examples all use an external file.
Best,
James
You could include the xml file in the app, have a look at the recent thread linked below which shows you how to find the path of the app. Then you could store it inside the "support" folder and use the "read" message to [pattrstorage] to load up your presets.
lh
Excellent. That's all I need!
Ok, I managed to get a pretty firm grasp of pattr and saving files to standalone - thanks very much for the responses.
One more question:
How does one make it so certain named objects are saved into the pattr's file at separate times? I want to ideally use only one file. The situation would be:
User saves a few objects into the file (with store and/or write) then - later the user might save a few other objects, but NOT change the first saved objects. In other words, different objects are saved at different times, excluding the objects that have already been saved.
Is it possible?
One way I could do it would be to simply use two preset objects and two files to be written to, but that seems kind of bulky.