Script for Open /Close Plugin Editor

I have this idea from the very beginning of using GP, and for nowadays this helps knowing more about scripts.
I can open OR close with a widget, but how to do it with the same widget? ON/OFF

OpenPlugin : Open the plugin editor
Declaration: function OpenPlugin (p : Block) autotype
Category: Plugins
Parameters
p : Block
Autotype

ClosePlugin : Close the plugin editor
Declaration: function ClosePlugin (p : Block) autotype
Category: Plugins
Parameters
p : Block
Autotype

Test newValue and call open or close depending on the result

Oh its closer; but not enough, sorry

var
    NormalStateButton : Widget
    Dexed : Block
    
    On WidgetValueChange(newValue : double) from NormalStateButton
    OpenPlugin(Dexed)
    
End

If newValue > 0.5
then openplugin…
Else closeplugin…
End

Etc

Yeah!! even with my musician coat on… getting the hang of it :wink:
Working!!
Thanks for help @david
Brace yourself for some crazy open/closing plugin window editors!!

var
    Dexed : PluginBlock
    OpenCloseButton : Widget

   On WidgetValueChanged(newValue : double) from OpenCloseButton
   If newValue > 0.5
    then OpenPlugin(Dexed)
    Else ClosePlugin(Dexed)
End
End

Is this script working now?
I was looking for a quick way to access the Plug-in Editor without having to go into Edit mode.
I tried entering the script but it showed an error, would be great if it works.
Does the Widget have to be assigned to the plug-in with no parameter selected for it to work?

What error are you getting?

Hi Daved, thanks for the quick reply.

The error message reads:

“Syntax Error: Line 4, Col 4: Unexpected or unrecognized token: ‘WidgetValueChange’
Mismatched input ‘WidgetValueChange’ expecting {Activate, Deactivate, Variation, TimerTick, TimePassing, NoteOnEvent, NoteOffEvent, NoteEvent, ControlChangeEvent, PitchBendEvent, AftertouchEvent, ProgramChangeEvent, PolytouchEvent, MidiEvent, ParameterValueChanged, WidgetValueChanged, OSCMessageReceived}”

I am new to GP and have not had time to study the Scripting language but this ‘Open Plugin Editor’ feature would be a great help to me right now.
Initially, I copied and pasted the Script into the Script Editor but have just tried typing it in and still get the same error.
Your help would be appreciated.
Martin

onWidgetValueChanged

just add a - d - WidgetValueChanged
(instead of WidgetValueChange)

Script language evolved…

@keyman I edited your script above to reflect that change to the keyword.

1 Like

Many thanks @dhj, (I tried but could not…)

I haven’t had a chance to look at permissioning for posts to see if there’s a way to allow a poster to modify his/her own post

Thanks for the replies everyone.
I am now getting the following error:
“Semantic error: Line 2, Col 13: Declarations of this type are not allowed”
Line 2 reads: Dexed : Block

Yeah, that got changed a long time ago as well

Change

Block

to

PluginBlock

1 Like

Thank you David, that worked to a degree. The Script compiled successfully but reported that the Plugin was now found so I see that the Word “Dexed” refers to the Plugin.
How do I find the correct name for the Plugin I wish to address?

Sorry for the questions, I am going to read and learn the programming manual just a soon as I’ve finished digesting all of the GP User Manaul.

This is indeed documented in the language manual

Right click on a block and there’s an option to set its name and enable OSC and/or GP Script support. Whatever name you define there should be the same as the declaration you use in the script

Thanks again, almost there but where do I find the Plugin Block to right click on?

Ah … Just seen the light. Found the Block, didn’t realize that’s what they were called.

That’s brilliant, all working now and making life much easier. Even learned some scripting along the way with reference to the manual.

Thanks for the help guys.

1 Like