Help - Search - Members - Calendar
Full Version: Code to scroll main window title
Hydrogenaudio Forums > Hosted Forums > foobar2000 > General - (fb2k)
James N
I like the option to scroll the window title in Winamp. So I wrote the following code to do something similar in foobar2000:

$puts(t,[%artist% - ][%tracknumber% - ]%title%$if(%artist%, *** ,))
$puts(l,$len($get(t)))
$puts(n,$mod($mul(%playback_time_seconds%, 3),$get(l)))
$trim(
$if(%ispaused%,$replace($get(t), *** ,' [Paused]'),
$right($get(t),$sub($len($get(t)), $get(n)))
$left($get(t), $get(n))
))

Feel free to use this script, but it has several shortcomings, and I was wondering if there was any way around them.

1) I couldn't find a way to change how often the window title is updated. Is there a way to do this?
2) It relies on %playback_time_seconds%, so the title won't scroll when foobar is paused. Is there another variable I could use, or is there a way to store 'static' variables that persist over different evaluations of the script?

Thanks in advance for your help.
Erich w/ an h
QUOTE(James N @ Jan 31 2007, 00:30) *
1) I couldn't find a way to change how often the window title is updated. Is there a way to do this?


do you mean like scrolling it more, or less, than once every second? you can use the $mod() function to make the scrollbar slower, but unfortunately once a second is the fastest you'll get it to scroll with time elapsed seconds. You *may* be able to script something that involves a VBR MP3's bitrate, as the bitrates can be updated more than once a second; it works nicely with my garble script.

as for scrolling when its paused, I dont think its possible. cwb_hooks has a var to get the systemtime, but i dont think that works when the track is paused. If it does, then you can use that. If it doesnt, I think thats the closest you can get, sorry.

Edit - heres my scrolling script for trackinfo_mod:

CODE
$puts(scrollwidth,136)
$puts(scrolltag1,$meta(title))
$puts(scrolltag,$get(scrolltag1) ● )
$puts(scroll1,$substr($get(scrolltag),$add($mod(%playback_time_seconds%,$len($get(scrolltag))),1),$len($get(scrolltag))))
$puts(scroll2,$substr($get(scrolltag1),$substr($get(scrolltag),$sub($len($get(scrolltag)),$add($mod(%playback_time_seconds%,$len($get(scrolltag))),1)),$len($get(scrolltag))),$len($get(scrolltag1))))

$drawrect(0,97,163,16,pencolor-0-0-0 brushcolor-$get(color1) width-1)
$alignabs(3,98,163,16,163,16)$font(verdana,8,,$get(color2))%tracknumber%. $ifgreater($calcwidth($get(scrolltag1)),$get(scrollwidth),$get(scroll1)$get(scroll2),$get(scrolltag1))


yours is a little nicer looking. I might edit mine to make it a little better looking.
James N
I wanted it to scroll more often, maybe 3 times a second, so I could take out the $mul(%playback_time_seconds%, 3) and make it a little smoother. But I couldn't get the %bitrate% trick to work. Thanks for the tip though. Oh well, it's not too bad as it is and it pretty much does what I want.
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.