How can I skip certain widgets when Saving/Opening(Loading) States❔

I love the idea of creating 3 or 4 buttons to load States from files, like Presets.
And I've been using this code:
send('', '/STATE/OPEN', 'StateTest.state')

Which is working but it saves also Play and Stop button values which messes up with how they behave.

Is there a way I can skip certain widgets❔

Push / tap / momentary are not supposed to be affected when loading a state file, but there might be a bug here, I'll investigate. Otherwise no you can't skip widgets except by modifying the file, or by going into some scripting I don't have time to unravel right now... (Preset saving to a file - #4 by BillTribble)

Could you please upload your session file ?

Okay, cool.

What about input widgets❔ They are also being affected and probably shouldn't.


Input widgets do hold a value and they should be affected by states. Just in case, make sure you're not giving the same id to multiple widgets, or sync mechanism will come into play.

Okay, that makes sense.
Just checked, not the same id.
The Play button is a toggle but the Stop button is momentary a̶n̶d̶ ̶i̶t̶'̶s̶ ̶b̶e̶i̶n̶g̶ ̶t̶r̶i̶g̶g̶e̶r̶e̶d̶ ̶b̶y̶ ̶t̶h̶e̶ ̶S̶t̶a̶t̶e̶ ̶l̶o̶a̶d̶i̶n̶g̶.̶

So, about this gif, actually that signal is being sent back from Reaper, it's not the loading of the State that's triggering it.
I'll have to do more studying about this problem.

Teste OSC 1.json (48.8 KB)

What about text :grey_question: Should text be updated with State loadings :grey_question: Now they are messing with my markers :sweat_smile::sweat_smile:

I think I'm gonna just edit the .state files. Not that hard to do.

An option/checkbox to "ignore state calls" would be nice but maybe it's just me, so it's fine.

Yes text widgets are supposed to be affected too (everything that has a state value is). I'm bookmarking this, will try to improve the situation in a future release.

1 Like

An update: Weirdly, the "problem" was Reaper... Even after deleting the stop button from the .state file, the stop button would still get a hit from the DAW after a state load. But that was because of the Record button... For some reason, if I send /record 0 (from a state load) it will send back /record 0 and /stop 1 for some reason. So now I'm deleting both from the .state files. I wrote a watcher in AutoHotkey to edit the .state files as soon as they are modified and send a OSC notification**. I might post it here once it's solid.


Hello, I came across this post wanting to do the exact same thing. It seems plausible to do with a custom module. For example, reading the state file and then filtering out the ones that I do not want to set. But in hopes to see how the built in load was functioning, I looked into the source code on github. The first question that came to mind was, instead of rebuilding the wheel, whether or not I could just override load(state, send, path) from a custom module. Is that possible? Thanks in advance. -Michael

It's not possible to override these. Here is a little example that should help you getting things done without reinventing the wheel:

state-cm.js (909 Bytes) (custom module)
state-example.json (9.8 KB) (session)

Filtering state can be done either in the session (save button's onValue script) or in the custom module.

I have little time right now to explain more in depth, but feel free to ask :wink:

Thanks! I was trying to get the state in the custom module from an external message, but I figured out how to do what I wanted using your paradigm.

The only problem is that I am actually saving the files with some of the keys removed using saveJSON, but I cannot use a ".state" extentions, which means I cannot load it through the editor. I guess I can change the file name after the fact using some native JS library.

Since v1.23.0 saveJSON is not restricted to .json files :slight_smile: