No internet connection
  1. Home
  2. Packages
  3. AAF ORGANIZER

Issues When the target track is within folders

By Victor Bresse @Victor_Bresse
    2022-07-26 13:38:02.860Z

    Hello,
    I love the Idea and help this Package brings; But
    I'm having issues with paste clip when the Track is within 2 folders;
    For Example I have my FX Folder divided into 3 Folders FXA, FXB, FXC When the Target track is within the FXA Folder it doesn't paste as I believe it doesn't find the Track...
    Is there a Way to Find the Track even if Inside Plenty of Folders?
    Thanks again for all the Time and Effort put in...

    • 5 replies
    1. S
      SoundFlow Bot @soundflowbot
        2022-07-26 13:38:04.805Z

        Thanks for posting a question or an issue related to the 'AAF ORGANIZER' package.
        This package is made by @Owen_Granich_Young. We're auto-tagging them here so that they will hopefully be able to help you.

        Please note, that the best way to get help with a script, macro or other content installed from the Store is to select the script you installed, then click the red Need help button, and then click "Get help with this script or macro".
        By using this workflow, the developer of the package will get access to more information so they'll be able to help you quicker.
        You can read more about how to best get help in this article: bit.ly/sfscripthelp

        1. O
          In reply toVictor_Bresse:

          Hey Victor, I"m not gonna lie I did not build this, I simply templated it. I know the original Script @chrscheuer built was long before folders even existed.

          Just tested myself it does seem to work ok with one folder deep but bug out once you go two folders deep.

          Error is at line 51

           if (!editPaste.isEnabled) throw 'Cannot paste here';
                  editPaste.elementClick({}, 'Could not paste clip');
                  success = true;
                  break;
          

          Full Script

          const trackNames = event.props.trackNames;
          
          sf.ui.proTools.appActivateMainWindow();
          sf.ui.proTools.invalidate();
          
          function cutButRememberSelection() {
          
              sf.ui.proTools.mainCounterDoWithValue({
                  targetValue: 'Samples',
                  action: () => {
                      //Get original selection
                      var originalSelection = sf.ui.proTools.selectionGetInSamples();
          
                      var editCut = sf.ui.proTools.getMenuItem('Edit', 'Cut');
                      if (!editCut.isEnabled) throw 'No clip selected';
                      editCut.elementClick({}, 'Could not cut clip');
          
                      sf.ui.proTools.selectionSetInSamples({
                          selectionStart: originalSelection.selectionStart,
                          selectionEnd: originalSelection.selectionEnd,
                      });
                  }
              });
          
          }
          
          function selectionOverlapsWithExistingClip() {
              return sf.ui.proTools.getMenuItem("Edit", "Trim Clip", "To Selection").exists;
          }
          
          function moveToTracks(trackNames) {
              var originalTrackName = sf.ui.proTools.selectedTrackNames[0];
          
              cutButRememberSelection();
          
              var success = false;
              for (var i = 0; i < trackNames.length; i++) {
                  var trackName = trackNames[i];
          
                  sf.ui.proTools.trackSelectByName({
                      names: [trackName],
                      deselectOthers: true,
                  });
          
                  //Update menu
                  sf.keyboard.press({ keys: 'cmd+shift+numpad plus,cmd+shift+numpad minus' });
                  if (selectionOverlapsWithExistingClip())
                      continue;
          
                  var editPaste = sf.ui.proTools.getMenuItem('Edit', 'Paste');
                  if (!editPaste.isEnabled) throw 'Cannot paste here';
                  editPaste.elementClick({}, 'Could not paste clip');
                  success = true;
                  break;
              }
          
              sf.ui.proTools.trackSelectByName({
                  names: [originalTrackName],
                  deselectOthers: true,
              });
          
              if (!success) {
                  sf.ui.proTools.getMenuItem('Edit', 'Undo Cut').elementClick();
              }
          }
          
          moveToTracks(trackNames);
          

          Any actual coders have any idea why this would bug out? I sadly do not.

          1. V
            In reply toVictor_Bresse:
            Victor Bresse @Victor_Bresse
              2022-07-27 17:38:54.777Z

              Thanks For Trying Owen!
              I did move the Track Out Of the Second Folder then Back In When I was done with the AAF...
              Hope someone would find an answer to this

              1. FFlorent SIMON @Florent_SIMON
                  2023-10-15 18:49:39.286Z

                  Hey @Victor_Bresse , I experiencing the same issue. Have you found any solution?

                  1. VVictor Bresse @Victor_Bresse
                      2023-10-16 13:31:35.705Z

                      Hi Florent,
                      No Not Really I take the Tracks Out of Folders.. Or I don't use the Macro...
                      If you get Somewhere Let me know...