No internet connection
  1. Home
  2. Macro and Script Help

editing existing scripts

By Elliott Blakey @Elliott_Blakey
    2023-03-28 15:57:50.764Z

    Title

    editing existing scripts

    What do you expect to happen when you run the script/macro?

    trying to alter a copy of an existing script from Surround Panning "Front Left -50 and ADD a "f/r 50" position.

    Are you seeing an error?

    What happens when you run this script?

    when adding what seems to be the logical additional step the result is f/r pan position moves to 100 at Center.

    How were you running this script?

    I clicked the "Run Script" or "Run Macro" button in SoundFlow

    How important is this issue to you?

    3

    Details

    {
        "inputExpected": "trying to alter a copy of an existing script from Surround Panning \"Front Left -50 and ADD a \"f/r 50\" position.",
        "inputIsError": false,
        "inputWhatHappens": "when adding what seems to be the logical additional step the result is f/r pan position moves to 100 at Center.",
        "inputHowRun": {
            "key": "-MpfwYA4I6GGlXgvp5j1",
            "title": "I clicked the \"Run Script\" or \"Run Macro\" button in SoundFlow"
        },
        "inputImportance": 3,
        "inputTitle": "editing existing scripts"
    }

    Source

    sf.ui.proTools.automationWindowRequireOpenAutomationWindow();
    sf.ui.proTools.automationPreview();
    sf.wait({
        intervalMs: 10,
    });
    sf.ui.proTools.selectedTrack.trackOutputToggleShow();
    sf.ui.proTools.mainTrackOutputWindow.elementWaitFor();
    sf.ui.proTools.mainTrackOutputWindow.elementRaise();
    sf.ui.proTools.trackOutputWindowResetPan();
    sf.wait({
        intervalMs: 10,
    });
    sf.ui.proTools.mainTrackOutputWindow.textFields.whoseTitle.is('Front Pan Numerical').first.elementClick();
    sf.wait({
        intervalMs: 10,
    });
    
    //Pan value of Front
    sf.keyboard.type({
        text: "-50",
    });
    
    sf.wait({
        intervalMs: 10,
    });    
    sf.ui.proTools.mainTrackOutputWindow.textFields.whoseTitle.is('F/R Pan Numerical').first.elementClick();
    sf.wait({
        intervalMs: 10,
    });
    
    //Pan value of Front
    sf.keyboard.type({
        text: "50",
    });
    
    sf.wait({
        intervalMs: 10,
    });
    sf.keyboard.press({
        keys: "return",
    });
    sf.wait({
        intervalMs: 10,
    });
    sf.ui.proTools.automationWriteAutoToSelectionAndClear();
    sf.ui.proTools.mainTrackOutputWindow.windowClose();
    
    

    Links

    User UID: SK2OrKHCrKbVX5Fh2WKlU93rwbA3

    Feedback Key: sffeedback:SK2OrKHCrKbVX5Fh2WKlU93rwbA3:-NRcw8w5ze8AM-xY4C7b

    Feedback ZIP

    • 2 replies
    1. Chris Shaw @Chris_Shaw2023-04-01 00:30:30.002Z2023-04-01 00:55:36.300Z

      @Elliott_Blakey I think you're missing a return keypress after entering -50 in line 19.
      Here's a revised script:
      (I replaced the return keypress with an enter keypress - just a preference of mine :) )

      sf.ui.proTools.automationWindowRequireOpenAutomationWindow();
      sf.ui.proTools.automationPreview();
      sf.wait({
          intervalMs: 10,
      });
      sf.ui.proTools.selectedTrack.trackOutputToggleShow();
      sf.ui.proTools.mainTrackOutputWindow.elementWaitFor();
      sf.ui.proTools.mainTrackOutputWindow.elementRaise();
      sf.ui.proTools.trackOutputWindowResetPan();
      sf.wait({
          intervalMs: 10,
      });
      sf.ui.proTools.mainTrackOutputWindow.textFields.whoseTitle.is('Front Pan Numerical').first.elementClick();
      sf.wait({
          intervalMs: 10,
      });
      
      //Pan value of Front
      sf.keyboard.type({
          text: "-50",
      });
      
      sf.keyboard.press({
          keys: "numpad enter",
      });
      
      sf.wait({
          intervalMs: 10,
      });    
      sf.ui.proTools.mainTrackOutputWindow.textFields.whoseTitle.is('F/R Pan Numerical').first.elementClick();
      sf.wait({
          intervalMs: 10,
      });
      
      //Pan value of Front
      sf.keyboard.type({
          text: "50",
      });
      
      sf.wait({
          intervalMs: 10,
      });
      
      sf.keyboard.press({
          keys: "numpad enter",
      });
      
      sf.wait({
          intervalMs: 10,
      });
      sf.ui.proTools.automationWriteAutoToSelectionAndClear();
      sf.ui.proTools.mainTrackOutputWindow.windowClose();
      
      1. Chris Shaw @Chris_Shaw2023-04-01 00:48:47.141Z2023-04-01 01:00:28.884Z

        I was bored so I refactored the script to be a bit more efficient and reusable.
        If you want to change the panners and their positions just change / add / remove them in the pansAndValues object!

        const pansAndValues = {
            'Front Pan Numerical': "-50",
            'F/R Pan Numerical': "50",
        }
        
        sf.ui.proTools.appActivateMainWindow();
        sf.ui.proTools.automationWindowRequireOpenAutomationWindow();
        sf.ui.proTools.automationPreview();
        sf.ui.proTools.selectedTrack.trackOutputToggleShow();
        sf.ui.proTools.mainTrackOutputWindow.elementWaitFor();
        sf.ui.proTools.mainTrackOutputWindow.elementRaise();
        sf.ui.proTools.trackOutputWindowResetPan();
        
        // Set panners
        for (const panner in pansAndValues) {
            //Click panner value
            sf.ui.proTools.mainTrackOutputWindow.textFields.whoseTitle.is(panner).first.elementClick();
        
            sf.wait({
                intervalMs: 10,
            });
        
            //Set pan value
            sf.keyboard.type({
                text: pansAndValues[panner],
            });
        
            sf.keyboard.press({
                keys: "numpad enter",
            });
        
            sf.wait({
                intervalMs: 10,
            });
        }
        
        sf.ui.proTools.automationWriteAutoToSelectionAndClear();
        sf.ui.proTools.mainTrackOutputWindow.windowClose();