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

Spot selected clips to original timecode not quite running

By Nick Norton @notNickNorton
    2023-01-05 20:33:25.515Z

    Title

    Spot selected clips to original timecode not quite running

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

    It's supposed to spot all of the selected clips to their original timecodes

    Are you seeing an error?

    It's throwing an error at lines 11, 34, and 37, and not completing the job

    What happens when you run this script?

    It works sometimes! I've been trying to replicate when it doesn't and it seems inconsistent. I'm sorry that's not more helpful - but try throwing a few clips onto the timeline and then running it. Sometimes they all spot to the correct original locations, sometimes it throws errors.

    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": "It's supposed to spot all of the selected clips to their original timecodes",
        "inputIsError": true,
        "inputError": "It's throwing an error at lines 11, 34, and 37, and not completing the job",
        "inputWhatHappens": "It works sometimes! I've been trying to replicate when it doesn't and it seems inconsistent. I'm sorry that's not more helpful - but try throwing a few clips onto the timeline and then running it. Sometimes they all spot to the correct original locations, sometimes it throws errors.",
        "inputHowRun": {
            "key": "-Mpfwh4RkPLb2LPwjePT",
            "title": "I used a keyboard shortcut within the target app"
        },
        "inputImportance": 3,
        "inputTitle": "Spot selected clips to original timecode not quite running"
    }

    Source

    function spotClipToOriginalTimeStamp() {
        //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,
        });
    }
    
    sf.ui.proTools.mainCounterDoWithValue({
        targetValue: 'Samples',
        action: () => {
            sf.ui.proTools.clipDoForEachSelectedClip({
                action: spotClipToOriginalTimeStamp
            });
        }
    })
    
    sf.ui.proTools.toolsSelect({
        tool: "Smart",
    });
    
    sf.ui.proTools.editModeSet({
      mode: "Slip",
    });
    

    Links

    User UID: qc6IBwD1stND4tFZaxUtM2qPuWS2

    Feedback Key: sffeedback:qc6IBwD1stND4tFZaxUtM2qPuWS2:-NL2crE_yg_QNU6akMgk

    Feedback ZIP

    Solved in post #2, click to view
    • 1 replies
    1. My guess is that you might be zoomed out too much for this to work well. If I recall correctly, the clip open spot dialog works by right clicking on where it thinks it needs to right click to select the current clip and then spot it. This works best if you're zoomed in enough so that all clips can be safely right clicked.

      ReplySolution