Changing Presets with widget

You are talking of “GP presets” but you are referencing to plugin presets (addressed via SelectPreset), which are diffrent things!
There are “GP User presets” and “Plugin presets” - the first ones have to be previously saved by the user, the other ones are provided (or not) by the plugin itself. Unfortunately there are a lot of plugins which don’t expose a preset list! So, using the internal “GP User Presets” will be the more reliable way to go!
If you have previously saved some “GP User Presets”, then all of them will be shown in a list.
See the documentation:

Of course, these “User Presets” can also be accessed via GP-Script, but then you’ll have to use the following functions:

GetGPPresetList : Get the Nth chunk of GP Preset names

  • Declaration: function GetGPPresetList (p : Block, chunkN : integer) autotype returns String Array
  • Category: Plugins
    Parameters * p : Block
    • chunkN : integer
  • Autotype
  • returns String

GetGPPresetListCount : Returns the number of GP Presets for this plugin

  • Declaration: function GetGPPresetListCount (p : Block) autotype returns Integer
  • Category: Plugins
    Parameters * p : Block
  • Autotype
  • returns Integer

LoadGPPreset : Load a GP plugin preset in the background - seriously experimental and probably very unsafe

  • Declaration: function LoadGPPreset (p : Block, presetName : String) autotype
  • Category: Plugins
    Parameters * p : Block
    • presetName : String
  • Autotype

That means, you’ll have to know the correct name for the preset.
You could also load the User-Presests list into a string array and get the name from there (via string comarison or index number,…).

You should use the search engine for “user presets” and you’ll find quite a few useful threads about this topic!
For example this rackspace/script i made some time ago:

Maybe that helps you somehow.

4 Likes