Help - Search - Members - Calendar
Full Version: How to make Shuffle Button, & Remember Selected File when
Hydrogenaudio Forums > Hosted Forums > foobar2000 > 3rd Party Plugins - (fb2k)
morphguy12
Hey guys, just got two quick questions, how can I make a shuffle button that stays highlighted when enabled, and also whenever I switch tabs, like from Playlist to Now Playing, when I go back to Playlist, everything resets to "All Artists"

Here's my code for the shuffle button: In TrackInfo_Mod
CODE
/// PerTrack

$button($sub($div(%_width%,2),193),12,0,0,0,0,dark1\buttons\now1.png,dark1\buttons\now2.png,dark3,)
$button($sub($div(%_width%,2),61),12,0,0,0,0,dark1\buttons\list1.png,dark1\buttons\list2.png,dark2,)
$button($add($div(%_width%,2),71),12,0,0,0,0,dark1\buttons\lyrics1.png,dark1\buttons\lyrics2.png,dark1,)

$if(%isplaying%,$if(%ispaused%,
$button($sub(%_width%,130),12,0,0,0,0,dark1\buttons\play1.png,dark1\buttons\play2.png,Play,),
$button($sub(%_width%,130),12,0,0,0,0,dark1\buttons\pause1.png,dark1\buttons\pause2.png,Pause,)),
$button($sub(%_width%,130),12,0,0,0,0,dark1\buttons\play1.png,dark1\buttons\play2.png,Play,))
$button($sub(%_width%,160),12,0,0,0,0,dark1\buttons\prev1.png,dark1\buttons\prev2.png,Previous,)
$button($sub(%_width%,100),12,0,0,0,0,dark1\buttons\next1.png,dark1\buttons\next2.png,Next,)
$button($sub(%_width%,70),12,0,0,0,0,dark1\buttons\stop1.png,dark1\buttons\stop2.png,Stop,)
$button($sub(%_width%,40),12,0,0,0,0,dark1\buttons\shnot.png,dark1\buttons\shnot.png,dark1\buttons\shsnot_over.png,'Shuffle (tracks)',)

$if($strcmp(%cwb_playback_order%,'Default'),
$button($sub(%_width%,40),12,0,0,0,0,dark1\buttons\shnot.png,dark1\buttons\shnot_over.png,'Shuffle (tracks)',)
,
$button2(5,5,0,0,50,20,'default','DEFAULT','Default',)
)
$button($sub(%_width%,40),12,0,0,0,0,
$if($stricmp(%cwb_playback_order%,'Shuffle (tracks)'),dark1\buttons\shnot_over.png,dark1\buttons\shnot.png),
$if($stricmp(%cwb_playback_order%,'Shuffle (tracks)'),dark1\buttons\shnot_over.png,dark1\buttons\shnot.png),
$if($stricmp(%cwb_playback_order%,'Shuffle (tracks)'),'Shuffle (albums)','Shuffle (tracks)')
,),)

// PerSecond
$alignabs(5,30,500,20,left,middle)
%cwb_playback_order%




SHNOT is the unglowing button, and SHNOT_OVER is the glowing button

I have tried with a couple of codes off of here, but I can get it 100% working, it goes on, but once it is on, I can't turn it off by clicking the button again.
Is it also possible to make an if statement that shuffles if the button is glowing (SHNOT_OVER) and doesnt if it is in normal mode?

Thanks!
Yotsuya
You are drawing the button twice, this is known to cause weirdness. Try commenting out the line toward the top:
CODE
$button($sub(%_width%,40),12,0,0,0,0,dark1\buttons\shnot.png,dark1\buttons\shnot.png,dark1\buttons\shsnot_over.png,'Shuffle (tracks)',)

Here's how I'd rewrite the button code toward the bottom.
CODE
$button($sub(%_width%,40),12,0,0,0,0,

$if($stricmp(%cwb_playback_order%,'Shuffle (tracks)'),
/dark1\buttons\shnot_over.png,dark1\buttons\shnot_over.png,
/dark1\buttons\shnot_over.png,dark1\buttons\shnot.png
),

/dark1\buttons\shnot_over.png,dark1\buttons\shnot_over.png,

$if($stricmp(%cwb_playback_order%,'Shuffle (tracks)'),
'Default',
'Shuffle (tracks)'
)

,)

Also your first line. I was under the impression that the refresh tags were supposed to have two slashes not three.
CODE
// PerTrack

Sorry if I've misunderstood what you are trying to do, give that a try and if it doesn't work please provide more detail. Are you trying to simply toggle between default playback and shuffle by tracks? or some sort of three way toggle including shuffle by album?
morphguy12
just trying to toggle the shuffle ,or normal playlist playback, I will try what ya said real quick, thanks! and Ill let ya know if that works

CODE
// PerTrack

$button($sub($div(%_width%,2),193),12,0,0,0,0,dark1\buttons\now1.png,dark1\buttons\now2.png,dark3,)
$button($sub($div(%_width%,2),61),12,0,0,0,0,dark1\buttons\list1.png,dark1\buttons\list2.png,dark2,)
$button($add($div(%_width%,2),71),12,0,0,0,0,dark1\buttons\lyrics1.png,dark1\buttons\lyrics2.png,dark1,)

$if(%isplaying%,$if(%ispaused%,
$button($sub(%_width%,130),12,0,0,0,0,dark1\buttons\play1.png,dark1\buttons\play2.png,Play,),
$button($sub(%_width%,130),12,0,0,0,0,dark1\buttons\pause1.png,dark1\buttons\pause2.png,Pause,)),
$button($sub(%_width%,130),12,0,0,0,0,dark1\buttons\play1.png,dark1\buttons\play2.png,Play,))
$button($sub(%_width%,160),12,0,0,0,0,dark1\buttons\prev1.png,dark1\buttons\prev2.png,Previous,)
$button($sub(%_width%,100),12,0,0,0,0,dark1\buttons\next1.png,dark1\buttons\next2.png,Next,)
$button($sub(%_width%,70),12,0,0,0,0,dark1\buttons\stop1.png,dark1\buttons\stop2.png,Stop,)
// $button($sub(%_width%,40),12,0,0,0,0,dark1\buttons\shnot.png,dark1\buttons\shnot.png,dark1\buttons\shsnot_over.png,'Shuffle (tracks)',)

$button($sub(%_width%,40),12,0,0,0,0,

$if($stricmp(%cwb_playback_order%,'Shuffle (tracks)'),
/dark1\buttons\shnot_over.png,dark1\buttons\shnot_over.png,
/dark1\buttons\shnot_over.png,dark1\buttons\shnot.png
),

/dark1\buttons\shnot_over.png,dark1\buttons\shnot_over.png,

$if($stricmp(%cwb_playback_order%,'Shuffle (tracks)'),
'Default',
'Shuffle (tracks)'
)

,)


The button doesn't show up now
Yotsuya
I did some testing and this should work:
CODE
// PerTrack

$button($sub($div(%_width%,2),193),12,0,0,0,0,dark1\buttons\now1.png,dark1\buttons\now2.png,dark3,)
$button($sub($div(%_width%,2),61),12,0,0,0,0,dark1\buttons\list1.png,dark1\buttons\list2.png,dark2,)
$button($add($div(%_width%,2),71),12,0,0,0,0,dark1\buttons\lyrics1.png,dark1\buttons\lyrics2.png,dark1,)

$if(%isplaying%,
$if(%ispaused%,
$button($sub(%_width%,130),12,0,0,0,0,dark1\buttons\play1.png,dark1\buttons\play2.png,Play,),
$button($sub(%_width%,130),12,0,0,0,0,dark1\buttons\pause1.png,dark1\buttons\pause2.png,Pause,)
),
$button($sub(%_width%,130),12,0,0,0,0,dark1\buttons\play1.png,dark1\buttons\play2.png,Play,)
)

$button($sub(%_width%,160),12,0,0,0,0,dark1\buttons\prev1.png,dark1\buttons\prev2.png,Previous,)
$button($sub(%_width%,100),12,0,0,0,0,dark1\buttons\next1.png,dark1\buttons\next2.png,Next,)
$button($sub(%_width%,70),12,0,0,0,0,dark1\buttons\stop1.png,dark1\buttons\stop2.png,Stop,)


$button($sub(%_width%,40),12,0,0,0,0,
$if($stricmp(%cwb_playback_order%,'Shuffle (tracks)'),dark1\buttons\shnot_over.png,dark1\buttons\shnot_over.png,dark1\buttons\shnot_over.png,dark1\buttons\shnot.png),
dark1\buttons\shnot_over.png,dark1\buttons\shnot_over.png,
$if($stricmp(%cwb_playback_order%,'Shuffle (tracks)'),'Default','Shuffle (tracks)')
,)

// PerSecond

$alignabs(5,30,500,20,left,middle)%cwb_playback_order%

However it would only update once per track and the button would only function once per track. I dunno if this is due to my recent upgrade to PanelUI or not so give it a try.
morphguy12
just tried it, and the button still isn't working,.. recopied over my stable copy of my foobar.cfg file, and still, same thing for some reason, any reason why?
morphguy12
could someone else test this too, I am trying to get it to work, but still nothing for some reason
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.