No internet connection
  1. Home
  2. How to

Spot first clip in clip list to original time stamp

By Martin Pavey @Martin_Pavey
    2020-02-05 19:04:15.443Z

    Hi Christian, I hope all is good for you.
    Is there a way to spot the selected clip in the clips list to its original timestamp on a selected track?
    I can get as far as getting it to a track in spot mode and then I don't know how to get to the original timestamp button in the spot window.
    Thanks

    Solved in post #5, click to view
    • 31 replies

    There are 31 replies. Estimated reading time: 14 minutes

    1. M
      Martin Pavey @Martin_Pavey
        2020-02-10 17:46:04.116Z

        Hi There,
        I tried to use the existing command for 'drag first clip list item to cursor' to get me half way towards this, but that command doesn't seem to work properly.
        It drags the clip on to the track but not at the cursor position.
        Is that command broken??

        1. Hi Martin

          That particular command relies on simulating a mouse drag, which is among the most fragile things you can do with SoundFlow, since tons of things can go wrong in the process.
          If you didn't need to spot from the clip list but could spot from say, an external file, we would have much more control since we can use our internal spotting API for it.
          Can you describe the more complete workflow you're looking for? Ie. why do you need to spot from the clip list to original timestamp? There might be a more stable solution around the corner if we can see the big picture

          1. MMartin Pavey @Martin_Pavey
              2020-02-10 19:38:33.259Z

              I suppose the dragging part isn't too important. How about a shortcut to spot the selected region to its original
              timestamp on a track. I have to do this hundreds of times a day when making deliverables.

              1. Kitch Membery @Kitch2020-02-23 09:28:48.676Z

                Hi Martin,

                This should work for spotting a single selected region to its original timestamp (if it is on a track already);

                //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();
                

                Hope that helps. :-)

                Reply1 LikeSolution
                1. MMartin Pavey @Martin_Pavey
                    2020-02-23 21:21:08.667Z

                    Hi Kitch,
                    Thanks for this, I'll give it a try and report back.
                    It was that pesky radio button that was giving me trouble, hopefully this will solve it.
                    All the Best
                    M

                    1. Kitch Membery @Kitch2020-02-23 21:27:08.998Z

                      My pleasure mate. Some of the Pro Tools buttons are not accessible unfortunately and so simulating the mouse click is the only way to get around it. SoundFlow is gaining some major traction so hopefully Avid will see this and make all of its elements accessible :-)

                    2. In reply toKitch:
                      Kitch Membery @Kitch2020-02-23 21:51:43.776Z

                      Hi @chrscheuer!

                      Is there a way run the above script for each selected clip.

                      Here is my attempt;

                      function spotClipToOriginalTimeStamp() {
                      
                          //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();
                      
                      }
                      
                      sf.ui.proTools.clipDoForEachSelectedClip({
                          action: spotClipToOriginalTimeStamp
                      });
                      

                      Rock on
                      Kitch

                      1. Try this:

                        
                        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
                                });
                            }
                        })
                        
                        
                        1. Kitch Membery @Kitch2020-02-23 22:09:05.599Z

                          Yes that works a treat! Thanks @chrscheuer. Although I won't use this shortcut as often as Martin, I wanted to make sure my understanding of the "clipDoForEachSelectedClip" function was sound.

                          @Martin_Pavey, the above is an updated script. It should work for multiple clips selected in the timeline.

                          1. Great to hear :)

                            1. VVanessa Garde @Vanessa_Garde
                                2021-08-25 15:10:27.215Z

                                Hi there!

                                I am trying the script in order to spot to original timestamp and bunch of audio clips and I get:

                                "25.08.2021 17:07:34.91 [Backend]: !! Command Error: Spot to Original Timestamp [user:default:cksrmj0mh0000uh10sa8dixhi]:
                                Error: Spot to Original Timestamp: Line 11
                                (Spot to Original Timestamp line 37) (Spot to Original Timestamp: Line 34)
                                "
                                Any help would be appreciated! :-)

                                Thanks a lot!

                              • In reply toKitch:
                                DDaniel Pinder @Daniel_Pinder
                                  2022-11-28 23:30:11.995Z2022-11-28 23:40:48.042Z

                                  Hi Kitch and Christian,
                                  I'm new at SF, but looking forward to diving in. I'm trying to repurpose this script to spot a bunch of clips to their original time stamps (and then do a laundry-list of other busywork). The above example (Christian's go) works fine with one clip selected, but fails only when I select multiple clips in the timeline:

                                  28.11.2022 15:28:42.29 [Backend]: JavaScript error with InnerException: More than one track selected (Spot By Track (TEST): Line 38)
                                  !! Command Error: Spot By Track (TEST) [user:clb19h94700003o10j7ouk5ef:clb1dvzsi0001zg1013epcgjc]:
                                  Error: Spot By Track (TEST): Line 38
                                  (Spot By Track (TEST) line 35)

                                  Thank you,

                                  Dan

                                  1. Kitch Membery @Kitch2022-11-29 00:32:02.321Z

                                    Hi @Daniel_Pinder,

                                    The best way to get help with scripts is to use the script help workflow.

                                    To learn how to do this please see the article/video at the following link bit.ly/sfscripthelp.

                                    Once you have done this it would be helpful if you could add a screen recording to the thread. Doing so will make it much easier for us to track down and hopefully resolve the issue.

                                    Thanks in advance :-)

                                    1. DDaniel Pinder @Daniel_Pinder
                                        2022-11-29 00:33:33.915Z

                                        It shall be done. Thank you and pardon my ignorance!

                                        1. Kitch Membery @Kitch2022-11-29 00:34:16.942Z

                                          Thanks you champion, much appreciated :-)

                                  2. In reply tochrscheuer:
                                    Fframpton6 @frampton6
                                      2022-08-15 04:06:46.425Z

                                      I'd love to use this, but could not get it working as is... error in line 34?

                                      1. Hi @frampton6,

                                        If you need help with a script, it's best to use the red "Need help" button because then we'd be able to see your logs etc :)

                                        See more here: bit.ly/sfscripthelp

                          2. M
                            In reply toMartin_Pavey:
                            Martin Pavey @Martin_Pavey
                              2020-02-23 22:17:46.838Z2020-02-23 22:54:15.227Z

                              That's great guys!
                              2 really useful shortcuts, for me at least and hopefully others.
                              I just added 2 commands to the end of Kitch's to get me back to square 1.

                              sf.ui.proTools.toolsSelect({
                                  tool: "Smart",
                              });
                              sf.ui.proTools.editModeSet({
                                mode: "Slip",
                              });
                              
                              1. Kitch Membery @Kitch2020-02-23 22:39:33.458Z

                                Perfect!

                                1. In reply toMartin_Pavey:
                                  Kitch Membery @Kitch2020-02-23 22:47:20.708Z

                                  FYI... you can add 3 back ticks (the key below the escape key) on a seperate line before and after the code, like this: ```
                                  to make your script appear in a box like this.

                                   Code here
                                  
                                  1. MMartin Pavey @Martin_Pavey
                                      2020-02-23 22:55:34.468Z

                                      Ah ha!
                                      I'd seen Christian say that but I couldn't find the backtick key before.
                                      Thanks Kitch.

                                  2. B
                                    In reply toMartin_Pavey:
                                    Brad Semenoff @Brad
                                      2020-12-24 01:10:38.950Z

                                      Hi All. I can't get Christian or Kitch's scripts to work consistently on my system. They both fail on the clipOpenSpotDialog line. I have a single clip on a track, activate the script, and each time it fails on that line. The only way that I can get it to work is to have the clip in question in dead center screen, so I'm assuming the clipOpenSpotDialog just simulates a right click in the center of the screen, is that correct?

                                      My ultimate goal is to create a script where I import a bunch of ADR clips to new tracks and then have Soundflow spot each clip to its original Timestamp on its own track.

                                      Thanks and happy holidays!

                                      1. Hi Brad,

                                        Is there a chance you are running other automation software (like KM?) and have something assigned to either the left or right arrow keys? The script may be using that to center the plugin, but if you have something else in the system filtering out those keystrokes you may be blocking the script from being able to center the click before making the right click.

                                        1. BBrad Semenoff @Brad
                                            2021-01-11 17:29:54.385Z

                                            Hi Christian,
                                            I did have KM running, but I quit it and the KM Engine to make sure and am still getting errors, albeit different ones this time. Now it seems that it fails while trying to get the selection length. The Length field highlights 4 times but nothing seems to happen.

                                            I have a screen recording of this, but the forum won't allow me to upload a .MOV file.

                                            Running Pro Tools Ultimate 2020.11.0
                                            Soundflow v4.1.10
                                            Mac OS 10.14.6

                                            1. Hi Brad,

                                              Thanks for that info.
                                              This sounds like an issue we're currently testing the fix for in our internal 4.2 beta.
                                              So I think we've already fixed it in the upcoming version.

                                              1. Andrew Scheps @Andrew_Scheps
                                                  2021-12-09 10:08:27.270Z

                                                  Just a heads up that this is still broken if you are zoomed out too much for the clip to be centered on the screen.

                                                  1. Thanks! Tracked as SF-392.

                                          • J
                                            In reply toMartin_Pavey:
                                            Jeremy Bowker @Jeremy_Bowker
                                              2021-01-11 00:17:45.347Z

                                              I initially had success with this but then started having the same problem as Brad. (I made sure any other automation program was off.) Also, should it be thrown into spot mode? I thought this was only for the clip spot dialog... (Is this something to do with the latest version of PT?)

                                              1. Can you share a screen recording of this when it's failing? That may be the quickest way for us to see if there's anything out of the ordinary going on.

                                                1. JJeremy Bowker @Jeremy_Bowker
                                                    2021-01-12 21:08:50.171Z

                                                    And it may have been user error (on my part).

                                                2. J
                                                  In reply toMartin_Pavey:
                                                  Julian David @Julian_David
                                                    2023-03-20 08:56:48.386Z

                                                    Hi all,
                                                    I'm also having issues getting this script to work and consistently get an error on line 11:
                                                    20.03.2023 09:55:44.63 [Backend]: !! Command Error: Spot Clips to Original Timestamp [user:default:clfgl8t3o0001qq10eubprkh8]:
                                                    Error: Spot Clips to Original Timestamp: Line 11
                                                    (Spot Clips to Original Timestamp line 37) (Spot Clips to Original Timestamp: Line 34)

                                                    I'm on PT Ultimate 2022.12.0

                                                    Any help would be much appreciated.