Defaults in standalone

May 8, 2009 at 5:50pm

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

#43735
May 8, 2009 at 7:18pm

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

http://www.xfade.com/max/examples/

#157062
May 8, 2009 at 8:26pm

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.

#157063
May 8, 2009 at 8:28pm

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

#157064
May 8, 2009 at 8:37pm

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

http://www.cycling74.com/forums/index.php?t=msg&goto=172240&rid=7622&S=dccedaf5cbcd9d3a961957a5a2f72d15#msg_172240

#157065
May 8, 2009 at 9:03pm

Excellent. That’s all I need!

#157066
May 11, 2009 at 11:48am

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.

#157067

You must be logged in to reply to this topic.