No internet connection
  1. Home
  2. How to

Get list of AAX plugins

By Robin Buyer @Robin_Buyer
    2022-02-09 18:08:15.768Z

    I'm trying to get a list of AAX plugins that are currently in my ProTools plugz folder:

    var sourcePath = '/Library/Application Support/Avid/Audio/Plug-Ins'
    var filesInFolder sf.file.directoryGetFiles({ path: sourcePath }).paths.map(x => x.split('/').slice(-1))
    

    But this seems to ignore all the .aaxplugin files and stores all the files that are NOT aax (.xml, .eng, etc).

    If I filter by .aaxplugin:

    var sourcePath = '/Library/Application Support/Avid/Audio/Plug-Ins'
    var filesInFolder = sf.file.directoryGetFiles({ path: sourcePath }).paths.filter(x => x.match('.aaxplugin')).map(x => x.split('/').slice(-1))
    

    Then nothing is stored in the filesInFolder var.

    Any thoughts on what I'm doing wrong/how to get the AAX plugins into a var? My end goal is to have a script that will take a list of plugins that I give it, ensure those are in the Plugins folder, and move everything else to unused.

    Thanks!

    Solved in post #2, click to view
    • 10 replies
    1. You need to use GetEntries :

      var sourcePath = '/Library/Application Support/Avid/Audio/Plug-Ins/'
      var filesInFolder  = sf.file.directoryGetEntries({ path: sourcePath }).paths.map(x => x.split('/').slice(-1))
      log (filesInFolder)
      
      ReplySolution
      1. The above code will give you an array of single entry arrays.
        If you want a comma and line return separated list use this:

        var sourcePath = '/Library/Application Support/Avid/Audio/Plug-Ins/'
        var filesInFolder = sf.file.directoryGetEntries({ path: sourcePath }).paths
            .filter(x => x.match('.aaxplugin')).map(x => x.split('/').slice(-1)).join(",\n")
        log(filesInFolder)
        
        1. Oops! Forgot to filter for aaxplugin.
          Above code corrected.

          1. RRobin Buyer @Robin_Buyer
              2022-02-09 18:41:59.146Z

              Works great, thanks Chris! What's the difference between GetFiles and GetEntries?

              1. Chris Shaw @Chris_Shaw2022-02-09 20:07:09.924Z2022-02-09 20:22:10.677Z

                I realized that the above script doesn't account for plugins that are in subdirectories in the Plug-ins folder (like UAD, Eventide, etc).

                This script is more thorough:

                const mainPluginFolder = ["/Library/Application Support/Avid/Audio/Plug-Ins/"];
                const subDirectoriesInFolder = sf.file.directoryGetDirectories({ path: mainPluginFolder[0] }).paths.filter(x => !x.match('.aaxplugin'));
                const allPluginFolders = mainPluginFolder.concat(subDirectoriesInFolder)
                
                var allPlugins = [];
                var tempArray = []
                
                allPluginFolders.forEach(
                    s => {
                        tempArray.push(sf.file.directoryGetDirectories({ path: s }).paths
                            .filter(x => x.match('.aaxplugin')).map(x => x.split('/').slice(-1)[0]));
                
                    })
                tempArray.forEach(i => i.map(x => allPlugins.push(x)))
                
                log(`You have ${allPlugins.length} plug-ins installed`)
                log(allPlugins)
                
                1. In reply toRobin_Buyer:

                  MacOS sits on top of a layer of UNIX. While we see applications and plugins as files, they are actually packages which are a special form of a directory. So when you use getFiles it will only return actual files, not directories or packages, That's why you need to use getEntries instead. It will return everything in a directory.

                  1. Oops Again,
                    Didn't use a recursive search - this should be it

                    sf.ui.proTools.invalidate();
                    const mainPluginFolder = ["/Library/Application Support/Avid/Audio/Plug-Ins/"];
                    const subDirectoriesInFolder = sf.file.directoryGetDirectories({ path: mainPluginFolder[0],isRecursive:true }).paths.filter(x => !x.match('.aaxplugin'));
                    const allPluginFolders = mainPluginFolder.concat(subDirectoriesInFolder)
                    
                    var allPlugins = [];
                    var tempArray = []
                    
                    allPluginFolders.forEach(
                        s => {
                            tempArray.push(sf.file.directoryGetDirectories({ path: s }).paths
                                .filter(x => x.match('.aaxplugin')).map(x => x.split('/').slice(-1)[0]));
                    
                        });
                    
                    tempArray.forEach(i => i.map(x => allPlugins.push(x)))
                    
                    log(`You have ${allPlugins.length} plug-ins installed`)
                    log(allPlugins)
                    
                    1. D'oh!
                      This is really it this time.
                      Much simpler:

                      const mainPluginFolder = "/Library/Application Support/Avid/Audio/Plug-Ins/";
                      
                      const allPlugins = sf.file
                          .directoryGetEntries({ path: mainPluginFolder, isRecursive: true })
                          .paths.filter((x) => x.endsWith(".aaxplugin")).map((x) => x.split("/").slice(-1)[0]);
                      
                      log(`You have ${allPlugins.length} plug-ins installed`);
                      log(allPlugins)
                      
                      
                      
                      1. same thing but removes.aaxplugin from the name

                        const mainPluginFolder = "/Library/Application Support/Avid/Audio/Plug-Ins/";
                        
                        const allPlugins = sf.file
                            .directoryGetEntries({ path: mainPluginFolder, isRecursive: true })
                            .paths.filter((x) => x.endsWith(".aaxplugin")).map((x) => x.split("/").slice(-1)[0].split(".aaxplugin")[0]);
                        
                        log(`You have ${allPlugins.length} plug-ins installed`);
                        log(allPlugins)
                        
                        1. RRobin Buyer @Robin_Buyer
                            2022-02-09 22:36:24.635Z

                            This is super helpful, thanks a bunch!