No internet connection
  1. Home
  2. How to

How to modify create or delete Temp Group

By Oscar van Hoogevest @Oscar_van_Hoogevest
    2019-10-08 16:24:02.425Z

    Hey fellow soundflow users or developers
    I would like to modify the "create or delete temp group command". It is working fine as it is, but I would like to have every attribute checked in the temp group itself. so that even the things I'm changing in the inserts or sends will be changed, when I change it in one of the channels. I am not javascript savvy... Could you please help me out with this?

    Solved in post #3, click to view
    • 7 replies
    1. Hello, Oscar!
      I could be wrong, but I think that the information about checkmarks when creating a group is stored in PT, based on checkmarks being set when you've created group the last time...

      So the possible solution is to:

      1. Create a group manually (using Cmd+G) and set the checkmarks to the values you will need in temp groups. (You can delete this group after this)
      2. Use Cmd+G to create/delete temp group. The Temp Group will be created with attributes the same as you set earlier.

      But I think that also you can script the changing of the checkmarks for particular states when creating a Temp Group. Someone who knows JS can help you with it (I dont...), if its the solution that you're looking for.

      1. Hi Oscar

        Yes, like Stepan is saying, you'll need to break the temp group creation command into a series of smaller actions, so that you can control what you're wanting to do.

        Here's a script to get you started:

        //Click "New Group..." in the group list popup menu
        var groupListPopup = sf.ui.proTools.groupsOpenListPopupMenu().popupMenu;
        groupListPopup.menuClickPopupMenu({ menuPath: ['New Group...'] });
        
        //Wait for Create Group dialog to appear
        sf.ui.proTools.createGroupDialog.elementWaitFor();
        var dlg = sf.ui.proTools.createGroupDialog;
        
        //Set the name to "Temp Group"
        dlg.textFields.first.elementSetTextFieldWithAreaValue({ value: 'Temp Group' });
        
        //Set "Follow Globals" to false
        dlg.checkBoxes.whoseTitle.is('Follow Globals').first.checkboxSet({ targetValue: 'Disable' });
        
        //Choose "Attributes" page
        dlg.radioButtons.whoseTitle.is('Attributes 2 of 3').first.elementClick();
        
        //Check all checkboxes
        dlg.checkBoxes.allItems.forEach(function(cb){ if (cb.title.value !== "Follow Globals") cb.checkboxSet({ targetValue: 'Enable' }); });
        
        //Click OK
        dlg.buttons.whoseTitle.is('OK').first.elementClick();
        
        //Wait for dialog to close
        dlg.elementWaitFor({ waitForNoElement: true });
        

        Note it might be quicker to recall a setting instead of manually clicking all the checkboxes :)

        Reply1 LikeSolution
        1. Thank you both very much! This also helps me to learn how it works in the background.

          Have a nice day!

          Greetings Oscar

          1. In reply tochrscheuer:

            Hey Christian
            The command works as it is, thank you very much.

            What would I have to add in the code, to delete the temp group with the same keystroke again (I'm using the multiplyer on the numpad). It is the same thing as in the default create/delete temp group.

            1. This one works for me to also delete if it exists:

              
              //Check if we have a group named "Temp Group"
              var hasTempGroup = sf.ui.proTools.mainWindow.groupListView.childrenByRole("AXRow").allItems.map(function (row) {
                  return row.children.allItems[1].children.first.title.value;
              }).some(function (groupTitle) { return groupTitle.indexOf('Temp Group') >= 0; });
              
              if (hasTempGroup) {
                  //We have a temp group
                  //Delete it
                  sf.ui.proTools.groupsDelete({ groupName: 'Temp Group' });
              
              }
              else {
                  //We don't have a Temp Group. Create one and set our preferred settings.
              
                  //Click "New Group..." in the group list popup menu
                  var groupListPopup = sf.ui.proTools.groupsOpenListPopupMenu().popupMenu;
                  groupListPopup.menuClickPopupMenu({ menuPath: ['New Group...'] });
              
                  //Wait for Create Group dialog to appear
                  sf.ui.proTools.createGroupDialog.elementWaitFor();
                  var dlg = sf.ui.proTools.createGroupDialog;
              
                  //Set the name to "Temp Group"
                  dlg.textFields.first.elementSetTextFieldWithAreaValue({ value: 'Temp Group' });
              
                  //Set "Follow Globals" to false
                  dlg.checkBoxes.whoseTitle.is('Follow Globals').first.checkboxSet({ targetValue: 'Disable' });
              
                  //Choose "Attributes" page
                  dlg.radioButtons.whoseTitle.is('Attributes 2 of 3').first.elementClick();
              
                  //Check all checkboxes
                  dlg.checkBoxes.allItems.forEach(function (cb) { if (cb.title.value !== "Follow Globals") cb.checkboxSet({ targetValue: 'Enable' }); });
              
                  //Click OK
                  dlg.buttons.whoseTitle.is('OK').first.elementClick();
              
                  //Wait for dialog to close
                  dlg.elementWaitFor({ waitForNoElement: true });
              
              }
              
              1. Note, if you store your setting of all checkboxes set to the 1st location (manually click Save and choose location 1), then you can change this line:

                //Check all checkboxes
                    dlg.checkBoxes.allItems.forEach(function (cb) { if (cb.title.value !== "Follow Globals") cb.checkboxSet({ targetValue: 'Enable' }); });
                

                to this:

                //Recall preset 1
                dlg.buttons.whoseTitle.is('1').first.elementClick();
                

                This would make your script significantly faster.

                1. Yes! Now it's perfect! thank you