Page 1 of 1

If-Then-Else for Variables

Posted: Sun Jul 30, 2017 2:24 pm
by Arthur Dent
Hi,

I'd like to have an "If-Then-Else" structure for variables. I have two types of filenames:
"Dance - Titel - Artist" and "Titel - Artist".

If I want to get the artist out of the filename it's easy:
%?F3;F2%
This is like "If F3 exists, use F3, else use F2"

But for the title I would need something like "If F3 exists, use F2, else use F1".

Alternatively a F1/F2/F3 variable which does not count from the beginning, but from the end, would also solve the task.

CU,
Arthur Dent

Re: If-Then-Else for Variables

Posted: Mon Jul 31, 2017 2:40 pm
by jtclipper
You can enforce complex logic using variable scripts in File/Options/Variables %..% (user page)

This one should work ok for you

Code: Select all

begin
  if gTag.ParseValue( '%F3%', false, false ) = '' then begin
     var_result( gTag.ParseValue( '%F1%', false, false ) );
  end else begin
     var_result( gTag.ParseValue( '%F2%', false, false ) );
  end;
end.
Click manage create a new one and save it as a file, then it will be available at the user submenu