FunnyFish wrote:I'm having problems with the new SETVAR function.
SetVar(vVarName, vValue) is a custom function which first argument could be a numeric or a string value. That value is a variable name, but not a variable itself. You could write something like SetVar(1, 1234) or SetVar("TrLen", 1234), but not SetVar(TrLen, 1234). So, your expression should be:
Code: Select all
iif (setvar ("totlen", setvar ("trlen", len (osongdata.trackorderstr) ) + iif (getvar ("trlen") > 0, len (" - ") , 0 ) + len( osongdata.artistname ) + len (" - ") + Len( osongdata.title )) > setvar ("maxplen", 64), "Warning:file name exceeds " & getvar ("maxplen") & " characters(" & getvar ("totlen") & ") - " & abs (getvar ("maxplen") - getvar ("totlen")) & " chars too much" , osongdata.lyricist )
However, I have several questions. Why do you have setvar (maxplen, 64) and getvar (maxplen) at all? Why don't you use just 64 instead? Also, instead of len (" - ") you could write just 3 and execution of such preset would be faster.
One more thing, I am not sure that expression setvar ("trlen", len (osongdata.trackorderstr) ) + iif (getvar ("trlen") is much shorter then len (osongdata.trackorderstr) + iif(len (osongdata.trackorderstr), and most probably it would be slower.
By the way, if you write "$&" instead of osongdata.lyricist then you could specify a destination field just by selecting a wanted field from the Into list.
Finally, why do you want to store such text into Lyricist field? Why don't you just choose Keep to Replace or Select to Replace instead of Replace All? Even better, you could use Magic Nodes add-on which would be much faster since it executes SQL to filter out wanted tracks instead of VBScript:
Code: Select all
<Group|Name:Tracks...>\Tracks which length of Track # - Artist - Title exceeds 64 characters|Icon:3|Filter:Length(<Track number>) + CASE WHEN Length(<Track number>) > 0 THEN 3 ELSE 0 END + Length(<Artist>) + 3 + Length(<Title>) > 64
FunnyFish wrote:PS: at the moment it's hard to find regexp documentation, apart from the forum stuff - are you planning to write an "official" Regexp manual? This would save hours of searching for me, and I suppose for a lot of other users too....

I am not sure by "regexp documentation" what do you mean. If you want to know more about Regular Expressions in general, you could find many on-line tutorials and manuals about them on the Internet - one
such link is even provided in the first post of this thread.
However, if you are interested about a manual for usage of this add-on, then you should be patient since I have a plan to write it someday.