# Automation ON/OFF

**URL:** <https://forum.juce.com/t/automation-on-off/65831>\
**Category:** Audio Plugins\
**Created:** [April 16, 2025, 9:02am UTC](https://forum.juce.com/t/automation-on-off/65831 "2025-04-16T09:02:07Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![grtaka](https://avatars.discourse-cdn.com/v4/letter/g/a6a055/32.png) [@grtaka](https://forum.juce.com/u/grtaka)\
**Post date:** [April 16, 2025, 9:02am UTC](https://forum.juce.com/t/automation-on-off/65831/1 "2025-04-16T09:02:07Z")

</div>

I have a question about turning automation on/off in ProTools.  
There is a button called Plug-In Automation Enable at the top of the plug-in.  
This button opens a dialog box where you can turn automation on/off (Add/Remove).  
There are plug-ins that allow you to do the same thing by using Control + Option + Command + Click in the plug-in GUI.  
I would like to know how this is achieved.  
The parameters are defined using AudioProcessorValueTreeState.

---

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [April 16, 2025, 9:18am UTC](https://forum.juce.com/t/automation-on-off/65831/2 "2025-04-16T09:18:43Z")

</div>

check AudioProcessorEditor ::getControlParameterIndex

---

<div class="post-metadata">

**Author:** ![grtaka](https://avatars.discourse-cdn.com/v4/letter/g/a6a055/32.png) [@grtaka](https://forum.juce.com/u/grtaka)\
**Post date:** [April 17, 2025, 4:42am UTC](https://forum.juce.com/t/automation-on-off/65831/4 "2025-04-17T04:42:12Z")

</div>

Thank you for any hints.  
I have tried it.  
int getControlParameterIndex(juce::Component& comp) override {  
return dynamic\_cast\<AudioParameterFloat\*\>(&comp)-\>getParameterIndex();  
}

The results of the test.  
Clicking on the desired component causes proTools to crash.  
Am I using the cast incorrectly?

---

<div class="post-metadata">

**Author:** ![otristan](https://avatars.discourse-cdn.com/v4/letter/o/f0a364/32.png) [@otristan](https://forum.juce.com/u/otristan)\
**Post date:** [April 17, 2025, 7:08am UTC](https://forum.juce.com/t/automation-on-off/65831/5 "2025-04-17T07:08:46Z")

</div>

Well I suppose not all you component (if any) inherit from AudioParameterFloat.  
This function take as input the widget under your mouse and try to get (if there is one) the associated parameter with it so you need to have a proper implementation of this logic according to your code.

---

<div class="post-metadata">

**Author:** ![grtaka](https://avatars.discourse-cdn.com/v4/letter/g/a6a055/32.png) [@grtaka](https://forum.juce.com/u/grtaka)\
**Post date:** [April 18, 2025, 7:16am UTC](https://forum.juce.com/t/automation-on-off/65831/6 "2025-04-18T07:16:02Z")

</div>

Any advice appreciated.  
That was an incorrect cast.  
I realized that the component being passed was a slider.

---

<div class="post-metadata">

**Author:** ![grtaka](https://avatars.discourse-cdn.com/v4/letter/g/a6a055/32.png) [@grtaka](https://forum.juce.com/u/grtaka)\
**Post date:** [April 20, 2025, 11:51pm UTC](https://forum.juce.com/t/automation-on-off/65831/7 "2025-04-20T23:51:49Z")

</div>

It was a success.  
Thanks to the advice I got from otristan.  
Thank you very much.

class JuceVstStudy1AudioProcessorEditor : public juce::AudioProcessorEditor  
{  
public:  
int getControlParameterIndex(juce::Component& c) override {

```
	if( juce::String( "TargetCompnentName" ) == c.getName() )
	{
		return valueTreeState.getParameter(juce::String( "TargetCompnentName" ))->getParameterIndex();
	}
	return -1;

```

}
