Help - Search - Members - Calendar
Full Version: how to use $if?
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Support - (fb2k)
jkwarras
Hi folks,

I was playing with $if fonction in foobar and if I've understood the simple use of it, I've been unable to achieve a little more complex things. So, I guess that again I'm looking for your unvaluable help rolleyes.gif

What i would like to understand is how to use $if when doing something like this (just an example but it could make me understand the use of it): I'm using column UI and under the tracknumber column I would like to

- Show >>> if track is playing
- Show [] if track is paused
- Show tracknumber if else

My poor understanding would make me paste something like this into the COlumn UI tracknumber:

$if(
$if(%_isplaying%,>>>,[$num(%tracknumber%,2)]),
$if(%_ispaused%,'[]',[$num(%tracknumber%,2)]))

That will just show nothing (empty field) in the column. If I use $if3 instead of $if (first $if) it show tracknumer when track is playing and [] when is paused. I'm sorry if this is obvious but I don't see where's the problem..my logic is poor, sorry blink.gif
Schinkentoni
Try this:

$if(%_ispaused%,'[]',$if(%_isplaying%,>>>,$num(%tracknumber%,2)))
jkwarras
QUOTE(Schinkentoni @ Jul 12 2004, 01:10 PM)
Try this:

$if(%_ispaused%,'[]',$if(%_isplaying%,>>>,$num(%tracknumber%,2)))
*



Thanks! smile.gif I'll study that for future stuff like that. It's good to learn everyday cool.gif
jkwarras
Well, I have another question, let's see if you can point me in the right direction smile.gif

How can I show X if a field has or is equal to Y? blink.gif

As an example let's say that I tag my files with %comment%=New and I want to show 'Recently added' if the comment fields has New.

I'm thinking something like the query= comment HAS New in the extended playlist generator.

I prefer HAS because in some fields I store more information than just 'New', for ex. 'New2004-02-15'

Is this possible? rolleyes.gif

Thanks guys.
kjoonlee
Look in your foobar2000\titleformat_help.html help file, please.

$strstr() should work for you.
sPeziFisH
Albeit titleformatting is not that hard to understand I got inspired by looking into 'Azrael' and other promising codes to get popular formattings and to have common workarounds *thumb up* smile.gif

btw:

$if($strstr($lower(%comment%),new),'Recently added',)
jkwarras
First, thanks for your help and replies smile.gif

@kjoonlee

Thanks for the tip. I've read the title formatting help, but sometimes I don't get what to (or how to) use. And believe me, I know my questions sounds silly... wink.gif

@sPeziFisH

Thanks for the code. I've been reading formatting strings, but never take a look at Azrael. I'll take a look at it to get 'inspiration' smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.