How can I improve the following slow process of tagging keys?

Hello everyone, I know there MUST BE a faster way of doing the following...

I am currently adding a tag to the "Comment" column that is based on the key of my sample file. What I am currently doing is the analyzing my entire directory, then ONE BY ONE I am filtering with the filters listed below, ONE KEY AT A TIME, and then I am manually adding the key in the comment field using the boxes on the left hand side of the screen, and lastly saving it to the metadata.

Here are the filters that I am using (but remember I am doing each line below ONE AT A TIME......)

%_filename% HAS "Am"OR %_folderpath% HAS "Am"
%_filename% HAS "A#m"OR %_folderpath% HAS "A#m"
%_filename% HAS "Abm"OR %_folderpath% HAS "Abm"
%_filename% HAS "Bm"OR %_folderpath% HAS "Bm"
%_filename% HAS "B#m"OR %_folderpath% HAS "B#m"
%_filename% HAS "Bbm"OR %_folderpath% HAS "Bbm"
%_filename% HAS "Cm"OR %_folderpath% HAS "Cm"
%_filename% HAS "C#m"OR %_folderpath% HAS "C#m"
%_filename% HAS "Cbm"OR %_folderpath% HAS "Cbm"
%_filename% HAS "Dm"OR %_folderpath% HAS "Dm"
%_filename% HAS "D#m"OR %_folderpath% HAS "D#m"
%_filename% HAS "Dbm"OR %_folderpath% HAS "Dbm"
%_filename% HAS "Em"OR %_folderpath% HAS "Em"
%_filename% HAS "E#m"OR %_folderpath% HAS "E#m"
%_filename% HAS "Ebm"OR %_folderpath% HAS "Ebm"
%_filename% HAS "Fm"OR %_folderpath% HAS "Fm"
%_filename% HAS "F#m"OR %_folderpath% HAS "F#m"
%_filename% HAS "Fbm"OR %_folderpath% HAS "Fbm"
%_filename% HAS "Gm"OR %_folderpath% HAS "Gm"
%_filename% HAS "G#m"OR %_folderpath% HAS "G#m"
%_filename% HAS "Gbm"OR %_folderpath% HAS "Gbm"

After filtering and adding the keytags using each line above, on by one, I then do it all over again with the following filters to catch anything that I missed:

%_filename% HAS "Amin"OR %_folderpath% HAS "Amin"
%_filename% HAS "A#min"OR %_folderpath% HAS "A#min"
%_filename% HAS "Abmin"OR %_folderpath% HAS "Abmin"
%_filename% HAS "Bmin"OR %_folderpath% HAS "Bmin"
%_filename% HAS "B#min"OR %_folderpath% HAS "B#min"
%_filename% HAS "Bbmin"OR %_folderpath% HAS "Bbmin"
%_filename% HAS "Cmin"OR %_folderpath% HAS "Cmin"
%_filename% HAS "C#min"OR %_folderpath% HAS "C#min"
%_filename% HAS "Cbmin"OR %_folderpath% HAS "Cbmin"
%_filename% HAS "Dmin"OR %_folderpath% HAS "Dmin"
%_filename% HAS "D#min"OR %_folderpath% HAS "D#min"
%_filename% HAS "Dbmin"OR %_folderpath% HAS "Dbmin"
%_filename% HAS "Emin"OR %_folderpath% HAS "Emin"
%_filename% HAS "E#min"OR %_folderpath% HAS "E#min"
%_filename% HAS "Ebmin"OR %_folderpath% HAS "Ebmin"
%_filename% HAS "Fmin"OR %_folderpath% HAS "Fmin"
%_filename% HAS "F#min"OR %_folderpath% HAS "F#min"
%_filename% HAS "Fbmin"OR %_folderpath% HAS "Fbmin"
%_filename% HAS "Gmin"OR %_folderpath% HAS "Gmin"
%_filename% HAS "G#min"OR %_folderpath% HAS "G#min"
%_filename% HAS "Gbmin"OR %_folderpath% HAS "Gbmin"

My main questions are the following:

  1. Is there a way that I can combine the 2 filter groups above? I can't seem to get the "HAS" "OR" terminology down properly.

2. Even better, is there a way to combine all of the filter categories above into a mega filter and then combine that with some sort of "IF STATEMENT" that can trigger an action to tag my comment field with the matching key???

Here is an image of what I am doing to better illustrate. I put red boxes around the 3 things that I am doing for my current slow process.

As far as I know, you are looking for chords?

If this is correct, there would be even more of such combinations:

and

and many more

Theoretically, you could create a regular expression to match this combinations, but such a command would become extremely complicated and nearly unreadable.

Answer to #1:
Does it work, if you combine them like this
%_filename% HAS "Amin" OR %_folderpath% HAS "Amin" OR %_filename% HAS "Am" OR %_folderpath% HAS "Am"

Answer to #2:
You can not trigger an action from a filter. There is no such IF statement.

Maybe you can adjust your workflow with the following steps:
Import the %_filename% in a temporary tag like MyFilename and %_folderpath% in MyFolderpath.
Then use an action group with many REPLACE actions like you use it currently in your filters?

Thanks alot. Yes but not only chords, even for vocals, other sample files, etc...

I'm basically trying to think of any combination of ways that the key (if applicable) could be labelled in the filename or folderpath, then extracting that data into a tag.

I will try what you said, wouldn't I have to find a way to ONLY extract a string from the filename or folderpath though? For example, would I have to modify anything while importing, to ONLY import the "Amin" part of the string to MyFileName and not the entire filename? After that, then it's just a matter of replacing the tag over to the comment tag!

Hello,

I think I found another way to do it and I am close to getting it right. I created a "Format Value" action to the "Comment" tag with the following format string:

$if2($strchr(%_filename%,Gm),Gm)

After applying this, the action correctly identified the files that have the text "Gm" in the filename, HOWEVER, instead of copying the text "Gm" to the Comment tag, it copied the number "5" to the Comment tag...?

Do you have any idea why it placed the number "5" there?

I'm just trying (if possible) to avoid having to Import the Filenames and Folderpaths as you said above because I have 330,000 files in total and it will take a long time. I will if necessary, though.

Here is an image of what I did since it's easier to visualize it:

Imgur: The magic of the Internet

If I see that correctly, you either have the term as second piece of data in the filename or it is preceeded by something numeric.
So you should be able to filter for
%_filename% MATCHES .*_\d+
and then import with the appropriate number of %dummy%_ placeholders around the data that you want.
And then filter for all the files where the comment is still empty.
And then add the data there from the appropriate position.

It is a shame really, that you did not create the filenames with a unified pattern.
And: wouldn't the better field for that data be INITIALKEY?

If you have a look at the scripting documentation for the $strchr command, you get

This returns the position number for the first occurence of Gm, in your screenshot example this is the 5th character from left.

For the IF command, we have 2 different syntax:

Your command should look more like this:
$if2($eql($strchr(%_filename%,'Gm'),0),Gm)
The problem with this syntax is, that it only compares the first character of the string Gm, (only the letter G). So this will NOT really work for your use case.

Yes, I would use $strstr().

Yet, I am still fairly sure that "gm also appears in Paradigma, Enigma, GmbH, Fragment, Sigmund, Bagman, Sigma, Bigmouth, Augmentation ...
and so on.
I would check for _Gm_

1 Like

Perhaps it would be an idea to first unify the filename pattern and either remove or move the numeric bit so that the key is always in second position.
Then it should be much easier to any string from that position.