No internet connection
  1. Home
  2. How to

Reveal selected in Workspace

By Kjartan Kjartansson @Kjartan_Kjartansson
    2023-06-26 12:14:24.841Z

    Hi.
    I can't see a possibility to use SoundFlow to have a selected clip on the timeline to be Revealed in workspace (in PT Ultimate 2023.6.0).
    If I select a clip on the timeline in PT and show the Clip List and contextual click on the selected clip in the Clip List I get a menu item called : Reveal in Workspace.

    This possibility is somewhat new to me in PT since it opens a Workspace that is more useful than the:
    Window/New Workspace/Default or
    Window/New Workspace/Soundbase

    With this workflow in PT it opens a very good version of the Workspace where it has located the Audio File in question and all the ones in the same daily folder.

    If I make a catalog for this in a Workspace Window I can of course browse and find the selected Audio File but the previously mentioned workflow is a much more efficient way to achieve the result.

    Can someone help me with a script that can reliably automate this in SoundFlow?

    • 7 replies
    1. F
      Forrester Savell @Forrester_Savell
        2023-07-01 05:29:47.480Z

        Hi @Kjartan_Kjartansson

        Does this script do what you're after? Let me know if I've missed what you were asking.

        sf.ui.proTools.appActivateMainWindow();
        
        //Ensure Clip List is visibile
        const isClipListVisible = sf.ui.proTools.getMenuItem("View", "Other Displays", "Clip List").isMenuChecked;
        
        sf.ui.proTools.menuClick({
            menuPath: ["View", "Other Displays", "Clip List"],
            targetValue: "Enable"
        });
        
        //Right-clicks on selected Clip and Reveals in Workspace
        var selectedClipRows = sf.ui.proTools.mainWindow.clipListView.getElements('AXSelectedRows');
        
        selectedClipRows[0].children.allItems[1].children.first.popupMenuSelect({
            isRightClick: true,
            menuPath: ['Reveal in Workspace'],
        });
        1. Thank you.
          I get this:
          01.07.2023 11:54:02.20 [Backend]: !! Command Error: PT Reveal selected in Workspace [user:default:cljcrlmui0000tq101oyy703v]:
          Could not open popup menu (PT Reveal selected in Workspace: Line 14)
          Popup menu was not found
          Popup window was not found after waiting 2000 ms

          Is this maybe because the popup menu for the clip is there and also a different popup menu is in the clip list?
          Either way the script can not find the pop up menu.
          One could argue that Pro Tools is not clever in using the two different popup menus.
          It would be best for the user to be able to only have to use one popup menu in the timeline.
          The clip list is so old and would need a complete overhaul.

          1. FForrester Savell @Forrester_Savell
              2023-07-01 23:07:36.284Z

              Hey @Kjartan_Kjartansson

              Here's an improved script. Requires Clip selection and ensures selected Clip is visible in Clip list before opening Workspace. Let me know if that works for you now?

              sf.ui.proTools.appActivateMainWindow();
              
              //Logs if no Clip is selected
              const audioExists = sf.ui.proTools.getMenuItem('Edit', 'Trim Clip', 'To File Boundaries').isEnabled;
              
              if (!audioExists) {
                  log('No Clip Selected');
                  throw 0;
              }
              
              // if visible, hide floating windows
              const areFloatingWindowsVisible = sf.ui.proTools.getMenuItem('Window', 'Hide All Floating Windows').isEnabled
              if (areFloatingWindowsVisible) {
                  sf.ui.proTools.menuClick({ menuPath: ['Window', 'Hide All Floating Windows'] })
              };
              
              //Enables Clip list visibility
              sf.ui.proTools.menuClick({
                  menuPath: ["View", "Other Displays", "Clip List"],
                  targetValue: "Enable",
              });
              
              //Clear Clip find
              sf.keyboard.press({
                  keys: "cmd+shift+d",
              });
              
              //Assigns clip name from Clip rename window
              let currentName = getRegionName();
              
              function getRegionName() {
              
                  sf.ui.proTools.menuClick({ menuPath: ['Clip', 'Rename...'] });
                  sf.ui.proTools.windows.whoseTitle.is('Name').first.elementWaitFor();
                  var regionName = sf.ui.proTools.windows.whoseTitle.is('Name').first.groups.whoseTitle.is('Name').first.textFields.first.value.value;
                  sf.ui.proTools.windows.whoseTitle.is('Name').first.buttons.whoseTitle.is('Cancel').first.elementClick();
                  return regionName
              }
              
              //Enters Clip name into Find Clips
              function putRegionName(currentName) {
              
                  sf.ui.proTools.appActivateMainWindow();
                  sf.keyboard.press({
                      keys: "cmd+shift+f",
                  });
                  sf.ui.proTools.windows.whoseTitle.is('Find Clips').first.elementWaitFor();
                  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: currentName, });
                  sf.ui.proTools.windows.whoseTitle.is('Find Clips').first.buttons.whoseTitle.is('OK').first.elementClick();
              
              }
              
              //Right-clicks on selected Clip and Reveals in Workspace
              function selectClipsInClipList() {
                  sf.ui.proTools.mainWindow.popupButtons.whoseTitle.is('Clip List').first.popupMenuSelect({
                      menuPath: ["Select", "All"],
                      targetValue: "Enable",
                  });
              
                  var selectedClipRows = sf.ui.proTools.mainWindow.clipListView.getElements('AXSelectedRows');
              
                  selectedClipRows[0].children.allItems[1].children.first.popupMenuSelect({
                      isRightClick: true,
                      menuPath: ['Reveal in Workspace'],
                  });
              }
              
              function main() {
                  getRegionName;
              
                  putRegionName(currentName);
              
                  selectClipsInClipList()
              };
              
              main();
              
              sf.keyboard.press({
                  keys: "cmd+shift+d",
              });
              1. Thank you very much for being so helpful. This is not a small script for you to write.
                I would never be able to come up with this.

                This is actually working until the workspace window shows the correct folder but with a really strange result.
                The selected audio file and all the ones with a higher take number are now missing in the Workspace folder!
                They are untouched in the Finder of course but this behaviour in the Workspace is un-coverable (even though I select the folder in the Workspace and update the index).
                I have made a catalog of the parent folder off all the location folders containing the Audio Files.
                I need to manually use that one to be able to retrieve another Audio File close by (which was the purpose of this whole matter).
                I have really never used the Workspace much since I can use Kraken and Soundminer for these things but I just like the idea of seeing the full day at once when searching for alternate lines. I guess I am old school in the sense that when having this overview of the whole shooting day I start to remember what we did that day (as I was also on location myself).

                1. FForrester Savell @Forrester_Savell
                    2023-07-02 23:45:17.520Z

                    Hi Kjartan

                    There is one issue I've realized which should be addressed, but I don't think it is related to your issue.
                    Can you delete the final lines 81 - 83. This key command doesn't work correctly when the Workspace window is open and actually is the shortcut to duplicate files, my bad.

                    sf.keyboard.press({
                        keys: "cmd+shift+d",
                    });
                    

                    With regards to your issue, are you implying that this script creates a Workspace window that is different somehow to when you manually right-click and select 'Reveal in Workspace' from the Clip list? Perhaps you can share a photo to help me understand the issue better.
                    I've noticed that when I run the script, due to the Workspace window being ordered by 'Name', that the selected file appears at the bottom of the list and I need to scroll further down to view subsequent 'higher' numbered takes/files.

                    1. cmd+shift-d is only clearing the find in the clip list. So no worries.
                      I will investigate better when I have time if the other matter has to do with the script or is maybe just a flaw in Pro Tools.

                      1. I checked the behaviour in Pro Tools and there is a very strange behaviour where many (maybe all) Audio Files are not listed in the Workspace Window that are already in the session. Maybe it is not only them (I would not know).
                        Anyway I dared to contextual click on the parent folder in the workspace and Deleted the Index (I wasn't sure what it meant but a prompt came up that it would delete all offline indexes which is fine).
                        After this all the Audio Files were listed correctly when I went in to the same folder.
                        Also, your script worked flawlessly. ;-)
                        The last lines do not execute since the Workspace is in focus and has no response to the cmd+shift+d script step.
                        They would execute correctly if the script would go back one window, fire the command and then it could forward one window again so the user would see the Workspace Window as intented.