Boolean script in an action


#1

Hi,

Second post today but different problem!

I'm trying to set up an action that uses a boolean function to determine if the directory name contains a specified string and if it does, to populate a field with that string.

This is what I have up to now but scripting and reg-ex etc are not my forte at all!

Action: Format value
Field: SOURCE
Format string: $if(_DIRECTORY HAS "(CD)",%SOURCE% IS "CD") IS YES

All I keep getting in the SOURCE field is [ INVALID $IF SYNTAX ] .

I've been using the filter box to do this but an action would be much easier as I can tell it to do more than one thing at a time with my intervention.

Can anyone help me, i'm pulling my hair out with this!

Thanks,
Paul


#2

You can't use the filter syntax with HAS & IS in ther formatstrings.

What exactly do you want to achieve?
If is is getting the media source out of the directory name into the SOURCE field, I can give you this monster-regex which I use as part of an action group for every album:

Action: Format Value
Field: SOURCE
Formatstring:
$regexp($regexp($if2(%source%,$if($eql($regexp(%_directory%,.\b(web|\dcd|vinyl|vls|cdm|cda)\b.,XXX,1),XXX),$regexp(%_directory%,.\b(web|\dcd|vinyl|vls|cdm|cda)\b.,$1,1),)),vls,vinyl,1),\d*(cd),$1,1)

Looks for the expressions WEB, CD, 2CD, 3CD, 4CD, ..., VINYL, VLS, CDM, CDA
first in the SOURCE field, and if this is empty in the folder name. But in the foldername only if is not part of a longer word.
In dependence on what expressions are found, it writes WEB, CD, or VINYL to the SOURCE field or leaves it empty if nothing is found.


#3

Wow you weren't kidding that is a beast of a regular expression! Your absolutely right I'm trying to extract the source media info from the folder name and store it in the tag. Your expression is exactly what I'm looking for thank you so much. This has got to be the most helpful forum on the web!
Paul