Scripting help: tie OpenPlugin() to front panel event

Hi. I’m just getting started with GP scripting and to GP in general… so maybe I’m thinking about GP wrong but I’d like to use the designer to place a button on the Rackspace front panel that opens my various plugin editors. I know that I can navigate to the Rackspace back panel and double-click or whatever… and I know that I can edit the front panel and click the widget and “Open Plugin” from there. … but I’d like to create custom buttons that let me open specific plugins from the front panel.

So I launched into learning the GP scripting and quickly found the OpenPlugin() function - but that function takes one parameter of type ‘Block’ . In the scripting documentation when I click on the ‘Block’ type it’s listed as a to-do to document it.

So could anybody offer help on how I might accomplish this (e.g. create a front panel button that opens the plugin editor for a particular plugin (whether using the OpenPlugin() function or not)? It seems to me that there might/should be a native widget control for this particular function that simply allows a front panel button to open the editor for the plugin that the widget is bound to: like a meta-Parameter similar to “Bypass plugin” at the top of the list of Mapping Parameters.

I feel like the documentation could really use examples that show more interaction between the GUI and the scripting. Right now from what I’ve seen in the scripting docs, the examples seem to assume that you already know how to put the glue between the scripting and the controls.

Thanks in Advance,

  • T

Hi @tmart, welcome to the comunity. Here is a gigfile with a widget button which opens a plugin window: Plugin_button.gig (8.7 KB)

It is based on this script:

//$
// DO NOT EDIT THIS SECTION MANUALLY
Var
PLUGIN : PluginBlock
PLUGIN_BUTTON : Widget
//$

// Called when a widget value has changed
On WidgetValueChanged(newValue : double) from PLUGIN_BUTTON

  If (newValue > 0.5)
  Then
    OpenPlugin(PLUGIN);
  Else
    ClosePlugin(PLUGIN)
  End
End

I think for this kind of thing it is also good to set the option in Options=>Preferences=>“Keep plugin window on top”.

I hope it is what you need, if not don’t hesitate to ask again :wink:

3 Likes

Thanks, @David-san

@tmart Note that you need to define handles for both the widget and the plugin block so that GPScript can find them.

Awesome! Thanks for the help; works like a charm. I guess I was misled by the documentation saying that a to-do was to document the ‘Block’ type. This gives me a kickstart; I really appreciate the quick response and script snippet.