More efficient way to select Group Plugin Controls and Bypass
Hi, can anyone suggest a more efficient way to enable the 10 Controls and Bypass check boxes in Group Attributes than what I've done in the below code?
Just a beginner, so couldn't decipher a way to modify the Check All Checkboxes code demonstrated in this thread How to modify create or delete Temp Group to just choose the Controls and Bypass check boxes.
Thanks!
sf.ui.proTools.appActivateMainWindow();
//Create Group
sf.ui.proTools.menuClick({
menuPath: ["Track","Group..."],
});
//Wait for Group Window
sf.ui.proTools.createGroupDialog.elementWaitFor({
waitType: "Appear",
});
//Input Group Name
var groupName = sf.interaction.popupText({
title: "Group Name?",
}).text;
sf.ui.proTools.createGroupDialog.textFields.first.elementSetTextFieldWithAreaValue({
value: groupName,
});
//Uncheck Follow Globals
sf.ui.proTools.createGroupDialog.checkBoxes.whoseTitle.is('Follow Globals').first.checkboxSet({ targetValue: 'Disable' });
//Choose "Attributes" page
sf.ui.proTools.createGroupDialog.radioButtons.whoseTitle.is("Attributes 2 of 3").first.elementClick();
//Enable Plugin Controls and Bypass F-J
sf.ui.proTools.createGroupDialog.checkBoxes.whoseTitle.is("CheckBox").allItems[1]
sf.ui.proTools.createGroupDialog.checkBoxes.whoseTitle.is("CheckBox").allItems[2]
sf.ui.proTools.createGroupDialog.checkBoxes.whoseTitle.is("CheckBox").allItems[3]
sf.ui.proTools.createGroupDialog.checkBoxes.whoseTitle.is("CheckBox").allItems[4]
sf.ui.proTools.createGroupDialog.checkBoxes.whoseTitle.is("CheckBox").allItems[5]
sf.ui.proTools.createGroupDialog.checkBoxes.whoseTitle.is("CheckBox").allItems[6]
sf.ui.proTools.createGroupDialog.checkBoxes.whoseTitle.is("CheckBox").allItems[7]
sf.ui.proTools.createGroupDialog.checkBoxes.whoseTitle.is("CheckBox").allItems[8]
sf.ui.proTools.createGroupDialog.checkBoxes.whoseTitle.is("CheckBox").allItems[9]
sf.ui.proTools.createGroupDialog.checkBoxes.whoseTitle.is("CheckBox").allItems[10]
//Click Ok
sf.ui.proTools.createGroupDialog.buttons.whoseTitle.is("OK").first.elementClick();
- Kitch Membery @Kitch2022-05-11 22:32:47.932Z
Which checkboxes do you want to be selected in the "Attributes" tab?
Is this what you are after?
Rock on!
- FForrester Savell @Forrester_Savell
Hi @Kitch
Yes, that or just the A-E or F - J inserts. I've mislabeled the description as F-J (it's currently A-E), but I was planning to have three scripts for all inserts, A-E, or F-J plugin control.
The
sf.ui.proTools.createGroupDialog.checkBoxes.whoseTitle.is("CheckBox").allItems[1]
lines are just made by using Click UI Element, but I assume there's a way to make an array for these or use the function command like on the linked thread.Thanks
Kitch Membery @Kitch2022-05-11 22:54:53.542Z
Ahh, Gotya,
Yeah, that should be doable. Stand-by! :-)
- In reply toForrester_Savell⬆:
Kitch Membery @Kitch2022-05-11 23:09:28.508Z
Here ya go! :-)
Let me know if it works for you.
const attributes = { controlsAtoE_TargetValue: "Enable", controlsFtoJ_TargetValue: "Disable", bypassesAtoE_TargetValue: "Enable", bypassesFtoJ_TargetValue: "Disable", } function setGroupAtributes(attributes) { const { controlsAtoE_TargetValue, controlsFtoJ_TargetValue, bypassesAtoE_TargetValue, bypassesFtoJ_TargetValue, } = attributes sf.ui.proTools.appActivateMainWindow(); //Create Group sf.ui.proTools.menuClick({ menuPath: ["Track", "Group..."] }); const createGroupDialog = sf.ui.proTools.createGroupDialog; //Wait for Group Window createGroupDialog.elementWaitFor(); //Input Group Name var groupName = sf.interaction.popupText({ title: "Group Name?", }).text; createGroupDialog.textFields.first.elementSetTextFieldWithAreaValue({ value: groupName, }); //Uncheck Follow Globals createGroupDialog.checkBoxes.whoseTitle.is('Follow Globals').first.checkboxSet({ targetValue: 'Disable' }); //Choose "Attributes" page createGroupDialog.radioButtons.whoseTitle.is("Attributes 2 of 3").first.elementClick(); sf.ui.proTools.invalidate(); //Arrow Function const enableCheckBoxes = (index, targetValue) => createGroupDialog.checkBoxes.whoseTitle.is("CheckBox").allItems[index].checkboxSet({ targetValue }); const controlsAtoEindexes = [1, 3, 5, 7, 9]; const controlsFtoJindexes = [11, 13, 15, 17, 19]; const bypassesAtoEindexes = [0, 2, 4, 6, 8]; const bypassesFtoJindexes = [10, 12, 14, 16, 18]; controlsAtoEindexes.forEach(index => enableCheckBoxes(index, controlsAtoE_TargetValue)); controlsFtoJindexes.forEach(index => enableCheckBoxes(index, controlsFtoJ_TargetValue)); bypassesAtoEindexes.forEach(index => enableCheckBoxes(index, bypassesAtoE_TargetValue)); bypassesFtoJindexes.forEach(index => enableCheckBoxes(index, bypassesFtoJ_TargetValue)); //Click Ok createGroupDialog.buttons.whoseTitle.is("OK").first.elementClick(); } setGroupAtributes(attributes);
BTW This would work well as a command template where you could have presets.
Rock on!
- In reply toForrester_Savell⬆:
Kitch Membery @Kitch2022-05-11 23:16:09.997Z
Oh... And you can change the settings by adjusting the target values in this object :-)
const attributes = { controlsAtoE_TargetValue: "Enable", controlsFtoJ_TargetValue: "Disable", bypassesAtoE_TargetValue: "Enable", bypassesFtoJ_TargetValue: "Disable", }
- FForrester Savell @Forrester_Savell
Amazing, thank you @Kitch , I'll give this a crack as soon as I'm back in front of the studio computer and report back. BTW what do mean work as a command template?
Kitch Membery @Kitch2022-05-11 23:36:06.894Z
Command templates are SoundFlow commands that have factory and user presets that run from one single script rather than having duplicated code.
They are powerful and great when you have to make updates as you only have to update one script.
So you'd have something like this;
- FForrester Savell @Forrester_Savell
Hey @Kitch
The original code above you posted works great, thank you for that, and I can create two scripts for the A-E or F-J options.
In an attempt to learn I've been bumbling around for the last few days to try and work out how to implement the Command Presets but I'm just stumped. I watched the FB live video @chrscheuer made showing how to use the User-Defined Enum (that you linked to in another post) and have created the Command Presets as you've done in your last screenshot, but I just can't work out how to apply the choice for each property I've created in the template to the script.
I've brought them in as constants
const controlFtoJ = event.props['controlF-J'] const bypassAtoE = event.props['bypassA-E'] const bypassFtoJ = event.props['bypassF-J']``` but beyond that would love to find out how to choose between the Enable / Disable switches. Thanks again for your help.
Kitch Membery @Kitch2022-05-15 22:21:27.363Z
It looks like you got close, but here is a step by step to show you how to make more of these :-)
-
Convert the Script into a template via the "Convert to Template" button (You've done this already.)
-
Click on the "Template" tab and remove any properties you've already created.
-
Create four new properties with the following property Titles & Script Name (the "Script Name" is what we will use to reference the command template preset settings.)
Title: Controls A-E , Script Name: controlsAtoE,
Title: Controls F-J , Script Name: controlsFtoJ,
Title: Bypasses A-E , Script Name: bypassesAtoE,
Title: Bypasses F-J , Script Name: bypassesFtoJ,- For each property in the template tab set the Type to "User-Defined Enum"
- For each of the properties add three "Enum Members" using the "+Add" button.
- For Each of the properties set the "Name/Values" of the "Enum Members" as follows (Enable, Disable, Toggle)
-
Set the "Default Value" to "Disable".
-
Return to the "Source" tab
-
At the top of the script add the following code which deconstructs the properties from the template tab allowing you to use them in the script.
const { controlsAtoE, controlsFtoJ, bypassesAtoE, bypassesFtoJ, } = event.props
Side note: This code does the same thing as the following code (Don't add this code);
const controlsAtoE = event.props.controlsAtoE; const controlsFtoJ = event.props.controlsFtoJ; const bypassesAtoE = event.props.bypassesAtoE; const bypassesFtoJ = event.props.bypassesFtoJ;
- Below the newly added code add the following code block;
const attributes = { controlsAtoE_TargetValue: controlsAtoE, controlsFtoJ_TargetValue: controlsFtoJ, bypassesAtoE_TargetValue: bypassesAtoE, bypassesFtoJ_TargetValue: bypassesFtoJ, }
Your script in its entirety should look like this;
const { controlsAtoE, controlsFtoJ, bypassesAtoE, bypassesFtoJ, } = event.props const attributes = { controlsAtoE_TargetValue: controlsAtoE, controlsFtoJ_TargetValue: controlsFtoJ, bypassesAtoE_TargetValue: bypassesAtoE, bypassesFtoJ_TargetValue: bypassesFtoJ, } function setGroupAtributes(attributes) { const { controlsAtoE_TargetValue, controlsFtoJ_TargetValue, bypassesAtoE_TargetValue, bypassesFtoJ_TargetValue, } = attributes sf.ui.proTools.appActivateMainWindow(); //Create Group sf.ui.proTools.menuClick({ menuPath: ["Track", "Group..."] }); const createGroupDialog = sf.ui.proTools.createGroupDialog; //Wait for Group Window createGroupDialog.elementWaitFor(); //Input Group Name var groupName = sf.interaction.popupText({ title: "Group Name?", }).text; createGroupDialog.textFields.first.elementSetTextFieldWithAreaValue({ value: groupName, }); //Uncheck Follow Globals createGroupDialog.checkBoxes.whoseTitle.is('Follow Globals').first.checkboxSet({ targetValue: 'Disable' }); //Choose "Attributes" page createGroupDialog.radioButtons.whoseTitle.is("Attributes 2 of 3").first.elementClick(); sf.ui.proTools.invalidate(); //Arrow Function const enableCheckBoxes = (index, targetValue) => createGroupDialog.checkBoxes.whoseTitle.is("CheckBox").allItems[index].checkboxSet({ targetValue }); const controlsAtoEindexes = [1, 3, 5, 7, 9]; const controlsFtoJindexes = [11, 13, 15, 17, 19]; const bypassesAtoEindexes = [0, 2, 4, 6, 8]; const bypassesFtoJindexes = [10, 12, 14, 16, 18]; controlsAtoEindexes.forEach(index => enableCheckBoxes(index, controlsAtoE_TargetValue)); controlsFtoJindexes.forEach(index => enableCheckBoxes(index, controlsFtoJ_TargetValue)); bypassesAtoEindexes.forEach(index => enableCheckBoxes(index, bypassesAtoE_TargetValue)); bypassesFtoJindexes.forEach(index => enableCheckBoxes(index, bypassesFtoJ_TargetValue)); //Click Ok createGroupDialog.buttons.whoseTitle.is("OK").first.elementClick(); } setGroupAtributes(attributes);
- The last thing to do is create new presets for the Command Template; and assign their settings.
And that's it. Let me know if you get stuck :-)
Rock on!
- FForrester Savell @Forrester_Savell
Thanks for stepping this through @Kitch , really appreciate it. All working here now.
Kitch Membery @Kitch2022-05-19 22:36:29.293Z
Awesome. Anything to help you mix more hit records Forrester! (It helps that you are Australian also ;-)
-