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

Opening Spot Dialog error

By Brenden @nednednerb
    2023-03-08 01:42:18.594Z

    Title

    Opening Spot Dialog error

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

    I want to spot a series of clips to original time stamp. I expect my main function to run for each clip selected at the start

    Are you seeing an error?

    I get an error in the script log, that Line 7 or the function to call up the Spot Dialog does not work.

    What happens when you run this script?

    When I run the script, it seems to make an incorrect selection and no spot dialog opens. When I alter the action in the final argument, I see the doForEachSelectedClip rotate through the function. It seems to be hung up on opening the spot dialog.

    How were you running this script?

    I used a keyboard shortcut within the target app

    How important is this issue to you?

    3

    Details

    {
        "inputExpected": "I want to spot a series of clips to original time stamp. I expect my main function to run for each clip selected at the start",
        "inputIsError": true,
        "inputError": "I get an error in the script log, that Line 7 or the function to call up the Spot Dialog does not work.",
        "inputWhatHappens": "When I run the script, it seems to make an incorrect selection and no spot dialog opens. When I alter the action in the final argument, I see the doForEachSelectedClip rotate through the function. It seems to be hung up on opening the spot dialog.",
        "inputHowRun": {
            "key": "-Mpfwh4RkPLb2LPwjePT",
            "title": "I used a keyboard shortcut within the target app"
        },
        "inputImportance": 3,
        "inputTitle": "Opening Spot Dialog error"
    }

    Source

    // housekeeping
    sf.ui.proTools.appActivateMainWindow();
    sf.ui.proTools.mainWindow.invalidate();
    
    // declare main function
    function spotThisClip() {
        sf.ui.proTools.clipOpenSpotDialog();
        sf.wait({intervalMs: 250,});
            //Click "Original Time Stamp button" in “Spot Dialog” window
        sf.ui.proTools.clipSpotDialog.mouseClickElement({
            relativePosition: {"x":270,"y":250}, 
        });
        sf.wait({intervalMs: 100,});
        sf.ui.proTools.clipSpotDialog.buttons.whoseTitle.is("OK").first.elementClick();
        sf.wait({intervalMs: 100,});
    };
    
    // run main function
    sf.ui.proTools.clipDoForEachSelectedClip({
        action: () => spotThisClip(),
    });
    

    Links

    User UID: hMEBO84NZbXqVbqYJzU5ZyTNHGN2

    Feedback Key: sffeedback:hMEBO84NZbXqVbqYJzU5ZyTNHGN2:-NPysXenKo6SZp8__m1N

    Feedback ZIP

    • 5 replies
    1. You may want to try Christian's script for this:
      (It's the last one in this post):
      Spot first clip in clip list to original time stamp

      You nay have to modify it slightly to return the edit mode (slip/spot/etc) to it's initial state

      1. In reply tonednednerb:
        Brenden @nednednerb
          2023-03-23 20:13:34.503Z

          Thanks Chris. I adapted the script for my own situation, which you can see below. I still get the same method clipOpenSpotDialog() error on line 16.

          // housekeeping
          sf.ui.proTools.appActivateMainWindow();
          sf.ui.proTools.mainWindow.invalidate();
          
          // declare main function
          function spotThisClip() {
              //Save current selection in Samples
              var selection = sf.ui.proTools.selectionGetInSamples();
          
              // Switch to the "Grabber" tool
              sf.ui.proTools.toolsSelect({
                  tool: "Grabber",
              });
          
              //Open the “Spot Dialog” window
              sf.ui.proTools.clipOpenSpotDialog();
          
              //Wait for “Spot Dialog” window
              sf.ui.proTools.clipSpotDialog.elementWaitFor();
          
              //Click "Original Time Stamp button" in “Spot Dialog” window
              sf.ui.proTools.clipSpotDialog.mouseClickElement({
                  relativePosition: { "x": 270, "y": 250 },
              });
          
              //Click “OK” button in “Spot Dialog” window
              sf.ui.proTools.clipSpotDialog.buttons.whoseTitle.is('OK').first.elementClick();
          
              //Wait for "Spot Dialog" to close
              sf.ui.proTools.clipSpotDialog.elementWaitFor({ waitForNoElement: true });
          
              //Restore selection from before
              sf.ui.proTools.selectionSetInSamples({
                  selectionStart: selection.selectionStart,
                  selectionEnd: selection.selectionEnd,
              });
          };
          
          // loop main function
          sf.ui.proTools.clipDoForEachSelectedClip({
              action: () => spotThisClip(),
          });
          
          // back to smart tool
          sf.ui.proTools.toolsSelect({
              tool: "Smart",
          });
          

          The relevant log entries for the last time I ran this script:

          23.03.2023 13:11:43.20 <info> [Backend]: Logging unknown error in action (02) DoMainCounterAction: Test-Script-PT: Line 16
          Logging unknown error in action (02) DoForEachClipAction: Test-Script-PT: Line 16
          
          23.03.2023 13:11:43.20 <info> [Backend]: Logging unknown error in action (02) DoForEachSelectedClipAction: Test-Script-PT: Line 16
          JavaScript error with InnerException: Spot Dialog didn't open (Test-Script-PT: Line 16)
          !! Command Error: Test-Script-PT [user:zap]:
          Error: Test-Script-PT: Line 16
          (Test-Script-PT line 40) 
          
          
          1. Brenden @nednednerb
              2023-03-23 20:24:33.907Z

              @Kitch, Should my script work, or is there a mistake somewhere? You were working on this in 2020! (My issue is low priority. This is just me trying to learn and troubleshoot.)

              In my session, I have 5 clips that have their original timestamps (5 random selections from the timeline).
              I cleared the clips from my timeline. I dragged all 5 clips end-to-end back into a timeline location.
              I want to run my script with the five clips selected, and I want the clips to be retimed to the original timestamp.

              It gets to the point where I expect the clipSpotDialog to appear, then fails. Perhaps the first clip is not getting selected or losing selection?

              A zip of my session can be accessed here: https://ln5.sync.com/dl/6864c8aa0/wihfygr7-yhmkktxu-8qt4jsnn-r8pc6n3i
              (File will be available for 2 weeks)

              1. Kitch Membery @Kitch2023-03-23 22:13:33.921Z

                Hi @nednednerb,

                I'll have to take a look at this early next week if that's alright. There is a bit to troubleshoot here. :-)

            • D
              In reply tonednednerb:
              David Forshee @David_Forshee3
                2024-08-25 20:39:26.124Z

                I'm also looking for a solution to this. Is there a way to consistently open the spot dialog? sf.ui.proTools.clipOpenSpotDialog only works occasionally for me.