I am creating an action group for formatting my tags and has just started playing with script functions.
(Using Action "Format Value", with Field TITLE just to see the output first.
My filename:
M1 - Something
Format string:
$if(0,yes,no)
Output:
no
I did this just to check if the if function accepts integer. (Edit: It doesn't. Even the value 1 will output 'no'.) Now to search for a string in the filename.
Format string:
$strstr(%_filename%,A)
Output:
0
Search for string worked. Now, to nest them.
Format string:
$if($strstr(%_filename%,A),yes,no)
Output:
yes
Now, that's weird. It should have just substituted the value of 0, but to the if function, it appears as true?
I thought that the $strstr() might be outputting a char instead an integer (if that distinction was ever in the code, I'm not sure). But I thought to try to compare the returned value if it is greater than 0.
Workaround:
$if($grtr($strstr(%_filename%,A),0),yes,no)
Output:
no
Also tried replacing the 'A' with an 'M', the output was yes, implying that the workaround succeeded.
Since it worked with the $grtr() function, shouldn't it work with the $if() function as well? I feel like this is unintentional. Fixing the $if() to work with $strstr() will surely help a lot in reducing the confusion and the script volume.
Thanks in advance!