No internet connection
  1. Home
  2. Support

Video Sync Offset SETUP script

By Dav3 @D_av_3
    2025-05-28 15:18:13.676Z

    Title

    Video Sync Offset SETUP script

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

    I would like to set the protools video sync offset to 20 ms.

    Are you seeing an error?

    28.05.2025 17:14:49.69 [Backend]: #StreamDeck: deck-button-click -> Dave Video Sync Offset 1/2 fr

    28.05.2025 17:14:49.69 [Backend]: >> Command: Dave Video Sync Offset 1/2 fr [user:cm5f1gz8b0000p710heyvb5bf:cmb6zdzbp0001a2103nr07u68]

    28.05.2025 17:14:49.69 [Backend]: [NSRunningApplication (static)] Checking for running apps with bundle 'com.avid.ProTools'
    NSArray.ArrayFromHandle count = 1

    28.05.2025 17:14:49.80 [Backend]: JavaScript error with InnerException: null
    !! Command Error: Dave Video Sync Offset 1/2 fr [user:cm5f1gz8b0000p710heyvb5bf:cmb6zdzbp0001a2103nr07u68]:
    ReferenceError: offsetIn is not defined
    (Dave Video Sync Offset 1/2 fr line 14)

    28.05.2025 17:14:49.80 [Backend]: << Command: Dave Video Sync Offset 1/2 fr [user:cm5f1gz8b0000p710heyvb5bf:cmb6zdzbp0001a2103nr07u68]

    28.05.2025 17:14:51.80 [EditorWindow:Renderer]: Active Focus Container: flow/content Line 33963 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar/dist/editor.js

    What happens when you run this script?

    Video sync offset window appears but nothing else happens I expected the required value to be automatically entered. I was trying to create 4 scripts with different values ​​but something is wrong

    How were you running this script?

    I used a Stream Deck button

    How important is this issue to you?

    4

    Details

    {
        "inputExpected": "I would like to set the protools video sync offset to 20 ms.",
        "inputIsError": true,
        "inputError": "\n28.05.2025 17:14:49.69  [Backend]: #StreamDeck: deck-button-click -> Dave Video Sync Offset 1/2 fr\n\n28.05.2025 17:14:49.69  [Backend]: >> Command: Dave Video Sync Offset 1/2 fr [user:cm5f1gz8b0000p710heyvb5bf:cmb6zdzbp0001a2103nr07u68]\n\n28.05.2025 17:14:49.69  [Backend]: [NSRunningApplication (static)] Checking for running apps with bundle 'com.avid.ProTools'\nNSArray.ArrayFromHandle count = 1\n\n28.05.2025 17:14:49.80  [Backend]: JavaScript error with InnerException: null\n!! Command Error: Dave Video Sync Offset 1/2 fr [user:cm5f1gz8b0000p710heyvb5bf:cmb6zdzbp0001a2103nr07u68]:\nReferenceError: offsetIn is not defined\n(Dave Video Sync Offset 1/2 fr line 14) \n\n\n28.05.2025 17:14:49.80  [Backend]: << Command: Dave Video Sync Offset 1/2 fr [user:cm5f1gz8b0000p710heyvb5bf:cmb6zdzbp0001a2103nr07u68]\n\n28.05.2025 17:14:51.80  [EditorWindow:Renderer]: Active Focus Container:  flow/content Line 33963 file:///Applications/SoundFlow.app/Contents/Helpers/SoundFlow.app/Contents/Resources/app.asar/dist/editor.js",
        "inputWhatHappens": "Video sync offset window appears but nothing else happens I expected the required value to be automatically entered. I was trying to create 4 scripts with different values ​​but something is wrong",
        "inputHowRun": {
            "key": "-MpfwmPg-2Sb-HxHQAff",
            "title": "I used a Stream Deck button"
        },
        "inputImportance": 4,
        "inputTitle": "Video Sync Offset SETUP script"
    }

    Source

    const offsetInMilliseconds = 20;
    
    sf.ui.proTools.appActivate();
    
    sf.ui.proTools.menuClick({ menuPath: ["Setup", "Video Sync Offset..."] });
    
    const videoSyncOffsetWindow = sf.ui.proTools.windows.whoseTitle.is("Video Sync Offset").first;
    
    videoSyncOffsetWindow.elementWaitFor();
    
    const msTextField = videoSyncOffsetWindow.textFields[0];
    const okButton = videoSyncOffsetWindow.buttons.whoseTitle.is("OK").first;
    
    msTextField.elementSetTextFieldWithAreaValue({
        value: offsetIn.toString(),
        useMouseKeyboard: true
    });
    
    sf.waitFor({
        callback: () => msTextField.invalidate().value.value === offsetInMilliseconds.toString(),
        timeout: 1000,
    }, `Could not set the Video Sync to ${offsetInMilliseconds.toString()}`);
    
    okButton.elementClick();
    
    okButton.elementWaitFor({ waitForNoElement: true });
    

    Links

    User UID: KrYW0iwNU1b7sFQU1hmzk5sFmRP2

    Feedback Key: sffeedback:KrYW0iwNU1b7sFQU1hmzk5sFmRP2:-ORMTEZxQ2sl-sguprma

    Feedback ZIP: YQ9mJis0+dkqGsR0rcMFO4Hdvq++s8qQcCEKeyT4D9tESYDl0/JauRU0Ri0cg+94wkpQKV/uDw9gfHObFC9M8OiT17DiZb78gcNWkkE5ELBsquHGOLPh0yY7AOad2P1IaLTld9zF5FFOoann+tP5wdes4QerzknjybTTVuxu70t3KEKDC46KGE2uqo8ZVecTqb/bFrDjEDRVV1i3FT0HljC8I2O93FhOsq2r6b7wR/SiBZykV/edHL1NSXnEpjd/FIXNL30+WitKTOtZDYyZKPvAoUq354rIbuavnj0eERBtfnCrilPBvL/bcUY5iMX11puEA67K9Iz+GXXE1U8IfQGFAIo9TbdtazSQl1fmYnw=

    Solved in post #3, click to view
    • 2 replies
    1. Chad Wahlbrink @Chad2025-05-28 18:54:16.279Z

      Hi, @D_av_3,

      Thanks for the question.

      I copied your script into SoundFlow and noticed that line 15 is underlined in red.

      This is because offsetIn is undefined and should be replaced with offsetInMilliseconds.toString().

      Here's the full corrected script:

      const offsetInMilliseconds = 20;
      
      sf.ui.proTools.appActivate();
      
      sf.ui.proTools.menuClick({ menuPath: ["Setup", "Video Sync Offset..."] });
      
      const videoSyncOffsetWindow = sf.ui.proTools.windows.whoseTitle.is("Video Sync Offset").first;
      
      videoSyncOffsetWindow.elementWaitFor();
      
      const msTextField = videoSyncOffsetWindow.textFields[0];
      const okButton = videoSyncOffsetWindow.buttons.whoseTitle.is("OK").first;
      
      msTextField.elementSetTextFieldWithAreaValue({
          value: offsetInMilliseconds.toString(),
          useMouseKeyboard: true
      });
      
      sf.waitFor({
          callback: () => msTextField.invalidate().value.value === offsetInMilliseconds.toString(),
          timeout: 1000,
      }, `Could not set the Video Sync to ${offsetInMilliseconds.toString()}`);
      
      okButton.elementClick();
      
      okButton.elementWaitFor({ waitForNoElement: true });
      
      1. Dav3 @D_av_3
          2025-05-28 19:49:15.299Z

          Awesome. Thanks! it works perfectly.
          Maybe I made some copy and paste mistakes.

          ReplySolution