How can I select file names from a folder according to a list?

Hi
This is my problem: I use an Apollo audio interface from Universal Audio (UA). This interface has built in dsp, an I have a lot of different software emulation of famous EQ’s compressors and reverbs. From time to time UA update this software and I download a complete file of ALL the software, that runs on the interface. The only way to install the update is to run an installer that will flood my plug-ins folders with all the updated versions, which means that I to scroll through a lot of plug-ins that I doesn’t own to find the “few” that I actually own and need to use.

So I need a way to filter the plug-ins I own. I had contact with a friendly member of another forum, who created a “solution” that unfortunately no longer works. It’s an Automator runtime - is it called that?, which first uses the Ask For Finder Item to locate the folder where all my plug-ins are stored inside, and this script is executed:

#!/bin/zsh

: <<-COMMENT

Compare list of owned component names to names of all component files downloaded
into the current directory location. Using list intersection, apply a red tag to
each owned (common) file in the directory.

COMMENT

zmodload zsh/mapfile

function tag_file () {
    osascript <<-AS
      use framework "Foundation"
      use AppleScript version "2.4"
      use scripting additions

      property NSURL : a reference to current application's NSURL
      property NSURLTagNamesKey : a reference to current application's NSURLTagNamesKey

      set taglist to {"${2}"}
      set tURL to NSURL's fileURLWithPath:"${1}"
      tURL's setResourceValue:taglist forKey:NSURLTagNamesKey |error|:(reference)
      return
AS
}

# always present a full path to the script
FOLDER="${@:a:s/\~\//}"
OWNED="vst_owned.txt"
# use empty "" quotes to remove tags
TAGNAME="RED"

# create three regular arrays for components owned, all component names in the folder,
# and the intersection (common) component names to be tagged
typeset -a compown=() filelist=() tagged=()

# filename containing list of owned components
FNAME=${FOLDER}/${OWNED}
# read owned components names from FNAME text file into an array
compown=( "${(f)mapfile[$FNAME]}" )

# generate an array of installed components names where (/) only
# uses the folder names matching the UAD* pattern.
cd "${FOLDER}"
setopt kshglob
filelist=( UAD*.vst(/) )

# array intersection showing owned components whose folder names are to be tagged
tagged=( ${filelist:*compown} )

for f in ${tagged}
do
    # any standard or custom tag name can be used here
    tag_file "$f" $TAGNAME
done
exit 0  

The text file: vst_owned.txt holds all the names of MY plug-ins and is used as a reference, and are placed in the folder with all the plug-ins.
The goal is to tag all the plug-ins that match a name from the file: vst_owned.txt with the tag red, so I can manually select all the plug-ins that have no tag and delete them.

But nothing happens! No files are tagged and the “funny” thing is, that if I have already tagged a file with red manually, the tag is deleted!!

I wish someone with experience in these matters would help me with this!

Regards Stig Christensen

Can you edit your post and put the code between triple back ticks? The forum is formatting it as Markdown text making it difficlt to read without copying it out and trying to modify it to read as one thinks it should be set - which risks an error in translation.

i.e.

``` 
All code goes between these back tick lines
``` 

Also, if you (backup your files) and run the script at the terminal, are the any errors? At first glance, all of the above looks like a command line script rather than being tied to an Automator action.

Thank you! I have done that!

Hi sylumer
I simply don’t know how to run this script in Terminal, sorry.

Plenty of info available online for this. Here’s the first one from a Google search.

Hopefully, that will get you on your way, but there are plenty of other guides out there to help you do this and it is HUGELY valuable to be able to do so.

If you really want to get a good handle on this, I would recommend reading or listening to the podcasts for Taming the Terminal.

https://ttt.bartificer.net/book.html

Thank you for your interest.
I will be honest with you and say, that I’m not interested in diving in deeper in the Terminal, how useful that could be, but I’m interested in a solution for my problem.
You now I spend all my day as a professional composer, arranger and music copyist and have done that for more than 35 years and I finally let my self of the challenge, of being able to solve all my technical issues by my self.
So frankly I’m just interested in help to make this script/Automator workflow work.

Thanks!

Unfortunately I don’t have your hardware, files, your particular Mac setup, etc. to test with. When things fail, they often tell you why. Automator is not giving you any of that, if it exists, because it is acting as a wrapper and potentially hiding it all the way - hence my suggestion of just running the script.

Given that the first link above does not appear to have been followed by anyone yet, I assume you have not assessed how much effort, and are basing this on some other prior experience of trying to learn the handful of steps required to do it.

On the assumption that you do have a good grasp of what is required, if the amount of effort you might have to expend to help others help you resolve your issue is too much in comparison to the amount of effort to manually mange your plugins challenge in the future, then you may well have found your reasonable threshold. And that’s fine - but do keep in mind this community is generally based around people supporting each other in enhancing their automation understanding, skills, and options.

If you want an easier approach with the minimum of effort, I would suggest going back to the root cause and reaching out to Univesal Audio. It may be they have some management options in their software that you are not aware of, (as I noted above, I don’t use this software so I can’t tell you… but maybe another forum user does and can?) or could incorporate one into a future software release. Many development teams are keen to make their software as useful for their user base as possible.