Simple script to select GP User Preset with widget

Hey everyone - I’m new to GP so still finding my way but would really appreciate if anyone can point at/provide any simple examples that achieve the following (which I could then adapt to my own setup):

I would like select a saved GP User Preset in a plugin by clicking a widget (say a Pad Button for example). I hope this is possible! I assume it requires a small amount of script, and have tried out a few things but to no avail (happy to post where I got to - but as it doesn’t work I’m not sure it’s useful :joy:)

I have tried to be a good citizen and perfumed may searches and read many posts, but most seem to steer the OP away from this approach towards variations, multiple plugin instances, or multiple rackspaces, so just to be clear I am OK on how to do these things, and see their value, and have also noted multiple warning about this approach not being recommended, but for various reasons in this case I wish to pursue the GP User Preset/Widget approach.

Your help is much appreciated :slight_smile:

The way to do this is by using the LoadGPPreset system function

Depending on how you name and save your presets, you can either manually define the names for this function, you can use variations that have the same names as the individual presets (thereby changing variation will load a new preset) or you can use the trick of naming your presets as 0, 1, 2, etc and then you can just a collection of widgets in a single callback to do it.

Here’s an example that assumes you have two presets for a plugin (replace the plugin that I used here unless you’ve already got it) and clicking one of the pads will load the preset

SimpleLoadGPPresetExample.gig (62.2 KB)

That is awesome - does exactly what I need :grinning:

So to adapt this for further presets I note that GP User Presets must be saved as sequential numbers from 0, but the widgets can have any GPS Script Name,

Is it possible to use text names for the GPS User Preset such as ‘Dark Matter’?

Sure but then you will have to change your script so that instead of just using that widget index, you would have to test the index and explicitly load the preset you want.

OK thanks - one for when I have more time to learn scripting properly (we’ll all be driving flying cars by then :joy:)
For now it’s a working solution for which I am very grateful thanks :slightly_smiling_face: