Re: Saving parameters to User Defaults


Forums > MaxMSP > Saving parameters to User Defaults
November 30, 2012 | 7:40 pm

I guess you can do it with coll but that seems cumbersome if you want to store multiple variables….

Why not just use [preset]? I mean, that’s what it’s there for, no? :)

The idea is this, on patch close you use a [closebang] to do -
- send a "store 1" message to [preset] to save current values
- then send a "write (path)/usersettings.maxpresets" to [preset] to save to disk

Then on patch open you use [loadbang] to:
- send a "read (path)/usersettings.maxpresets" to [preset]
- send a "1" to recall the preset slot.

On Mac, it’s ideal to read/write to Macintosh HD/Users/Shared to avoid permissions problems.
On Windows, you can write to "C:Documents and SettingsAll UsersApplication Data". On XP at least… later versions of Windows are slightly different paths, I think.

Hope this helps!