Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: What's wrong with this formatting string? (Read 2570 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

What's wrong with this formatting string?

Hello,

I tried to convert some files with diskwriter using this formatting string (my portable only works correctly with 8.3 filenames, in case you wonder):
Code: [Select]
$if($and(%artist%,$and(%title%,$and(%album%,%tracknumber%))),
%artist%\%album%\$cut($abbr(%artist%),3)$cut($abbr(%album%),3)$num(%tracknumber%,2),
%_filename%)

What I get are directories named [SYNTAX ERROR IN FORMATTING STRING] (something like that). What mistake am I making? This works (backslashes removed):
Code: [Select]
$if($and(%artist%,$and(%title%,$and(%album%,%tracknumber%))),
%artist%%album%$cut($abbr(%artist%),3)$cut($abbr(%album%),3)$num(%tracknumber%,2),
%_filename%)

And this also works:
Code: [Select]
%artist%\%album%\$cut($abbr(%artist%),3)$cut($abbr(%album%),3)$num(%tracknumber%,2)

Any help appreciated.

What's wrong with this formatting string?

Reply #1
Diskwriter splits the string at backslashes before evaluating it.

What's wrong with this formatting string?

Reply #2
Hmm. Any workarounds?

 

What's wrong with this formatting string?

Reply #3
Try:
Code: [Select]
$if($and(%artist%,%title%,%album%,%tracknumber%),%artist%,)\
$if($and(%artist%,%title%,%album%,%tracknumber%),%album%,)\
$if($and(%artist%,%title%,%album%,%tracknumber%),
$cut($abbr(%artist%),3)$cut($abbr(%album%),3)$num(%tracknumber%,2),
%_filename%)


note:  successive backslashes will be merged into one and directories with an empty name are not created.