No internet connection
  1. Home
  2. Support

Soundflow cannot find the 'Find Clips' dialogue box. (Inconsistent)

By Randall Smith @Randall_Smith
    2022-10-07 21:38:51.645Z

    Soundflow cannot find the 'Find Clips' dialogue box. (Inconsistent)

    System Information

    SoundFlow 5.1.11

    OS: darwin 17.7.0

    ProductName: Mac OS X
    ProductVersion: 10.13.6
    BuildVersion: 17G8037

    Steps to Reproduce

    1. Print stems sets in PT
    2. MOve down to delivery tracks
    3. run 'Add Leader Build Timeline' script

    Expected Result

    Should grab the countdown leader from the clip bin and move to 59:50:00, consolidate as a clip group.

    Actual Result

    Can't find the 'Find Clip' window, causing the clip to fail out.

    Workaround

    Run the script until it works. It sometimes works and sometimes fails.

    Other Notes

    I have video of this working properly and failing. This worked 100% of the time on 5v.0.5


    Links

    User UID: h5usDXSaKHSy12ByPzI67bSN9353

    Feedback Key: sffeedback:h5usDXSaKHSy12ByPzI67bSN9353:-NDoNkE33aUBUepRxlby

    Feedback ZIP

    • 6 replies
    1. R
      Randall Smith @Randall_Smith
        2022-10-07 21:39:39.540Z
        
        const subClipGroup = "Texted - 16 Ch"
        const genClipGroup = "Textless - 10 Ch"
        const currentTimecode = sf.ui.proTools.selectionGet().mainCounter.trim();
        //const memoryLocations = sf.proTools.memoryLocationsFetchFromGui().collection.list.filter(x => x.name.match("Airmaster"))
        
        sf.ui.proTools.appActivate();
        
        
        function findLocationName(locationName){
        sf.ui.proTools.mainCounterSetValue({ targetValue: "Samples" })
        const memoryLocations = sf.proTools.memoryLocationsFetchFromGui().collection.list.filter(x =>
            x.mainCounterValue >= userSelection.selectionStart &&
            x.mainCounterValue <= userSelection.selectionEnd &&
            x.name.match(locationName))
        return memoryLocations
        }
        
        function doSomething(memoryLocations) {
              sf.ui.proTools.nudgeSet({
                value: "00:00:10:00.00",
            });
        
            sf.ui.proTools.memoryLocationsGoto({
                memoryLocationNumber: memoryLocations.number
            })
        
                //do stuff here
                    sf.ui.proTools.memoryLocationsGoto({
                memoryLocationNumber: memoryLocations.number
            })
        
            sf.keyboard.press({ keys: "numpad minus", });
            sf.ui.proTools.menuClick({ menuPath: ["Edit", "Paste"] })
        }
        
        function chopEndPage(memoryLocations) {
        
              sf.ui.proTools.memoryLocationsGoto({
                memoryLocationNumber: memoryLocations.number
            })
              sf.ui.proTools.nudgeSet({
                value: "00:00:00:10.00",
            });
             sf.keyboard.press({ keys: "down", });
        
            //sf.keyboard.press({ keys: "numpad minus", });
        
            sf.keyboard.press({ keys: "s", });
        
            sf.keyboard.press({ keys: "numpad minus", });
        
            sf.keyboard.press({ keys: "g", });
        
        
        }
        
        
        function copyClipToPlayHead(name) {
        
        
            sf.keyboard.press({
                keys: "cmd+shift+d",
            });
        
            sf.keyboard.press({
                keys: "cmd+shift+f",
            });
        
            sf.ui.proTools.windows.whoseTitle.is('Find Clips').first.checkBoxes.whoseTitle.is('By name').first.checkboxSet({
                targetValue: "Enable",
            });
        
            sf.ui.proTools.windows.whoseTitle.is('Find Clips').first.textFields.whoseTitle.is('').first.elementSetTextFieldWithAreaValue({
                value: name,
            });
        
        
            sf.ui.proTools.windows.whoseTitle.is('Find Clips').first.buttons.whoseTitle.is('OK').first.elementClick();
        
        
            sf.ui.proTools.mainWindow.popupButtons.whoseTitle.is('Clip List').first.popupMenuSelect({
                menuPath: ["Select", "All"],
                targetValue: "Enable",
            });
        
            const row = sf.ui.proTools.mainWindow.clipListView.childrenByRole("AXRow").first;
        
        
            row.children.allItems[1].children.first.popupMenuSelect({
                isRightClick: true,
                menuPath: ['Object Select in Edit Window'],
                onError: "Continue",
            });
        
            //copy selected clip
        
            sf.keyboard.press({
                keys: "cmd+c",
            });
        
        sf.wait({
            intervalMs: 200,
        });
        
            sf.ui.proTools.memoryLocationsTempGoto({
                tempNumber: 1,
            });
        
        
            sf.keyboard.press({ keys: "numpad minus", });
        
            sf.keyboard.press({ keys: "cmd+v", });
        
            sf.keyboard.press({
                keys: "cmd+shift+d",
            });
            sf.keyboard.press({
                keys: "shift+tab",
            });
        
            sf.ui.proTools.menuClick({
                menuPath: ["Clip", "Group"],
            });
         
        
            sf.ui.proTools.menuClick({
                menuPath: ["Edit", "Copy"],
            });
        
        
            // sf.ui.proTools.nudgeSet({ value: "00:00:00:01.00", });
        }
        
        const userSelection = sf.ui.proTools.selectionGetInSamples()
        
        sf.ui.proTools.menuClick({
            menuPath: ["View", "Other Displays", "Clip List"],
            targetValue: "Enable",
        });
        
        sf.ui.proTools.memoryLocationsTempCreate({
            tempNumber: 1,
        });
        
        sf.ui.proTools.appActivateMainWindow();
        
        sf.ui.proTools.mainWindow.gridNudgeCluster.popupButtons.whoseTitle.is('Nudge value').first.popupMenuSelect({
            menuPath: ['Follow Main Time Scale'],
            targetValue: 'Disable',
        });
        sf.ui.proTools.mainWindow.gridNudgeCluster.popupButtons.whoseTitle.is('Nudge value').first.popupMenuSelect({
            menuPath: ['Timecode'],
            targetValue: 'Enable',
        });
        copyClipToPlayHead(subClipGroup);
        
        findLocationName("am").forEach(doSomething)
        findLocationName("EP Out").forEach(chopEndPage)
        //const memoryLocations = sf.proTools.memoryLocationsFetchFromGui().collection.list.filter(x => x.name.match("EP Out"))
        //memoryLocations.forEach(chopEndPage)
        findLocationName("txt").forEach(doSomething)
        //findLocationName("Submaster").forEach(doSomething)
        
        sf.ui.proTools.mainCounterSetValue({ targetValue: "Timecode" })
        copyClipToPlayHead(genClipGroup);
        
        findLocationName("tls").forEach(doSomething)
        //findLocationName("Generic").forEach(doSomething)
        
        
        sf.ui.proTools.mainCounterSetValue({ targetValue: "Timecode" })
        sf.ui.proTools.nudgeSet({ value: "00:00:00:01.00", });
        
        1. Kitch Membery @Kitch2022-10-11 02:28:57.098Z

          Hi @Randall_Smith,

          I just did a refactor on this script and hopefully it should address the " cannot find the 'Find Clips' dialogue box" error you are seeing.

          I'm assuming that the error is due to using a keyboard shortcut to open the "Find Clips" dialog. That's because simulating key presses and mouse movements is the least stable method of automation, so wherever possible its best to use UI automation over Keyboard and mouse simulation.

          I'm not sure how your session is set up exactly, and have not fully tested this, so let me know if you are still seeing the error or it's still not working as expected. :-)

          const subClipGroupName = "Texted - 16 Ch"
          const genClipGroupName = "Textless - 10 Ch"
          
          function getMemoryLocationsByName({ locationName, selection }) {
              sf.ui.proTools.mainCounterSetValue({ targetValue: "Samples" });
          
              const memoryLocations = sf.proTools.memoryLocationsFetchFromGui().collection["List"].filter(x =>
                  x.mainCounterValue >= selection.selectionStart &&
                  x.mainCounterValue <= selection.selectionEnd &&
                  x.name.match(locationName));
          
              return memoryLocations;
          }
          
          function doSomething(memoryLocations) {
              //Set Nudge Value
              sf.ui.proTools.nudgeSet({ value: "00:00:10:00.00", });
          
              //Navigate to Memory location
              sf.ui.proTools.memoryLocationsGoto({ memoryLocationNumber: memoryLocations.number });
          
              //Nudge Back
              sf.keyboard.press({ keys: "numpad minus", });
          
              //Paste
              sf.ui.proTools.menuClick({ menuPath: ["Edit", "Paste"] });
          }
          
          function chopEndPage(memoryLocations) {
              //Navigate to Memory location
              sf.ui.proTools.memoryLocationsGoto({ memoryLocationNumber: memoryLocations.number });
          
              //Set Nudge Value
              sf.ui.proTools.nudgeSet({ value: "00:00:00:10.00", });
          
              //De-select selection
              sf.keyboard.press({ keys: "down", });
          
              //Trim Clip End to cursor
              sf.keyboard.press({ keys: "s", });
          
              //Trim End by nudge Value
              sf.keyboard.press({ keys: "numpad minus", });
          
              //Add Fade to End
              sf.keyboard.press({ keys: "g", });
          }
          
          function copyClipToPlayHead(name) {
              //Clear Find Clips
              sf.keyboard.press({ keys: "cmd+shift+d", });
          
              //Open "Find clips" window
              sf.ui.proTools.mainWindow.popupButtons.whoseTitle.is('Clip List').first.popupMenuSelect({
                  menuPath: ["Find..."],
              });
          
              const findClipsWindow = sf.ui.proTools.windows.whoseTitle.is('Find Clips').first;
          
              //Wait for "Find Clips" window
              findClipsWindow.elementWaitFor();
          
              //Enable "By Name" checkbox
              findClipsWindow.checkBoxes.whoseTitle.is('By name').first.checkboxSet({
                  targetValue: "Enable",
              });
          
              //Enter text into "By Name" field
              findClipsWindow.textFields.whoseTitle.is('').first.elementSetTextFieldWithAreaValue({
                  value: name,
              });
          
              //Click OK
              findClipsWindow.buttons.whoseTitle.is('OK').first.elementClick();
          
              //Wait for "Find Clips" window to disappear
              findClipsWindow.elementWaitFor({
                  waitForNoElement: true
              });
          
              //Select All matching clips
              sf.ui.proTools.mainWindow.popupButtons.whoseTitle.is('Clip List').first.popupMenuSelect({
                  menuPath: ["Select", "All"],
                  targetValue: "Enable",
              });
          
              const firstClipListRow = sf.ui.proTools.mainWindow.clipListView.childrenByRole("AXRow").first;
          
              //Select matching clips in Edit Window.
              firstClipListRow.children.allItems[1].children.first.popupMenuSelect({
                  isRightClick: true,
                  menuPath: ['Object Select in Edit Window'],
                  onError: "Continue",
              });
          
              //Copy selected clip
              sf.ui.proTools.menuClick({ menuPath: ["Edit", "Copy"], });
          
              sf.wait({ intervalMs: 200, });
          
              //Goto Temp Marker 1
              sf.ui.proTools.memoryLocationsTempGoto({ tempNumber: 1, });
          
              //Nudge Back
              sf.keyboard.press({ keys: "numpad minus", });
          
              //Paste
              sf.ui.proTools.menuClick({ menuPath: ["Edit", "Paste"], });
          
              //Clear Find Clips
              sf.keyboard.press({ keys: "cmd+shift+d", });
          
              //Extend Selection
              sf.keyboard.press({ keys: "shift+tab", });
          
              //Grouo Clips
              sf.ui.proTools.menuClick({ menuPath: ["Clip", "Group"], });
          
              //Copy
              sf.ui.proTools.menuClick({ menuPath: ["Edit", "Copy"], });
          }
          
          function main() {
              sf.ui.proTools.appActivateMainWindow();
              sf.ui.proTools.mainWindow.invalidate();
          
              const originalUserSelection = sf.ui.proTools.selectionGetInSamples();
          
              //Ensure Clip list is visible
              sf.ui.proTools.menuClick({
                  menuPath: ["View", "Other Displays", "Clip List"],
                  targetValue: "Enable",
              });
          
              //Invalidate Main window
              sf.ui.proTools.mainWindow.invalidate();
          
              //Create Temp Marker 1
              sf.ui.proTools.memoryLocationsTempCreate({
                  tempNumber: 1,
              });
          
              sf.ui.proTools.appActivateMainWindow();
          
              const gridNudgeCluster = sf.ui.proTools.mainWindow.gridNudgeCluster;
              const nudgeValuePopup = gridNudgeCluster.popupButtons.whoseTitle.is('Nudge value').first;
          
              //Disable "Follow Main Time Scale"
              nudgeValuePopup.popupMenuSelect({
                  menuPath: ['Follow Main Time Scale'],
                  targetValue: 'Disable',
              });
          
              //Enable "Timecode" in Nudge Value popup
              nudgeValuePopup.popupMenuSelect({
                  menuPath: ['Timecode'],
                  targetValue: 'Enable',
              });
          
              copyClipToPlayHead(subClipGroupName);
          
              getMemoryLocationsByName({ locationName: "am", selection: originalUserSelection }).forEach(doSomething);
          
              getMemoryLocationsByName({ locationName: "EP Out", selection: originalUserSelection }).forEach(chopEndPage);
          
              getMemoryLocationsByName({ locationName: "txt", selection: originalUserSelection }).forEach(doSomething);
          
              //Switch main counter to Timecode
              sf.ui.proTools.mainCounterSetValue({ targetValue: "Timecode" });
          
              copyClipToPlayHead(genClipGroupName);
          
              getMemoryLocationsByName({ locationName: "tls", selection: originalUserSelection }).forEach(doSomething);
          
              //Switch main counter to Timecode
              sf.ui.proTools.mainCounterSetValue({ targetValue: "Timecode" });
          
              //Set Nudge Value
              sf.ui.proTools.nudgeSet({ value: "00:00:00:01.00", });
          }
          
          main();
          

          Rock on!

          1. RRandall Smith @Randall_Smith
              2022-10-14 13:53:39.927Z

              Thank you. I will give this a test as soon as possible. The issue I am running into is not that it can't pull up the find dialogue, but that soundflow will then not find the text area in the dialogue window. I don't know if it would help, but I do have a screen capture of the script failing out.

              1. Kitch Membery @Kitch2022-10-14 17:47:24.827Z

                Hi @Randall_Smith,

                The screen capture would be great to see for sure.

                I changed the keyboard press to opening the menu item via the dropdown menu. My thought is that there is a chance that Pro Tools may not be reporting to the system that the UI has changed when using the keypress and so the text field may not be visible to SoundFlow. I also added a wait for the "Find Clips" window, to make sure that the script was looking for the text field before it existed.

                Looking at the script again, you may also try changing lines 68-71 from...

                    //Enter text into "By Name" field
                    findClipsWindow.textFields.whoseTitle.is('').first.elementSetTextFieldWithAreaValue({
                        value: name,
                    });
                

                to

                    //Enter text into "By Name" field
                    findClipsWindow.textFields.first.elementSetTextFieldWithAreaValue({
                        value: name,
                    });
                

                Let me know how it goes. :-)

                1. RRandall Smith @Randall_Smith
                    2022-10-14 18:02:36.616Z

                    So far so good. I will play with it a bit more to make sure, but seems to be working now.

                    Thanks,
                    Randall

                    1. Kitch Membery @Kitch2022-10-14 18:03:25.093Z

                      Awesome. Keep me posted :-)