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: integrating numeric clock? (Read 2281 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

integrating numeric clock?

is it possible to display the local time in Default UI?

with the textdisplay-component its not possible, no syntax therefor...

is there any chance to display the local PC Time in foobar2000 in DUI
or at least with a component for CUI?

integrating numeric clock?

Reply #1
what's wrong with the windows clock in the notification area?

anyway, it is possible using WSH panel mod. download it and add it to your layout (it works in default UI or columns UI)

http://www.hydrogenaudio.org/forums/index....showtopic=70363

then paste in this code....

Code: [Select]
var bg_colour = RGB(0,0,0);
var text_colour = RGB(255,0,0);
var font = gdi.font("Calibri", 32);

///////////////////////////////////////////////////////////////////////
var g_timer = window.CreateTimerInterval(1000);
var ww = 0; wh = 0; h = 0; m = 0; s = 0;

function RGB(r,g,b) {
return (0xff000000|(r<<16)|(g<<8)|(b));
}

function on_size() {
    ww = window.Width;
    wh = window.Height;
}

function on_timer(id) {
    var currentTime = new Date();
    h = currentTime.getHours();
    m = currentTime.getMinutes();
    s = currentTime.getSeconds();
    window.Repaint();
}

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, bg_colour);
    gr.GdiDrawText((h == 0 ? "00" : h < 10 ? "0" + h : h) + ":" +  (m < 10 ? "0" + m : m) + ":" + (s < 10 ? "0" + s : s), font, text_colour, 0, 0, ww, wh, 0x00000001 | 0x00000004 | 0x00000010 | 0x00000400 | 0x00000800);
}

the first 3 lines are configurable. you can set the background and text colour and mess around with the font and font size.

integrating numeric clock?

Reply #2
thank you lord - works perfect!!!

i just want to add the letters "LOCAL TIME" above the timeline.
will find out where to put in the code for correct display...

thanks a bunch for the code!!!

btw - i implemented foobar2000 in our community radio station.
there we want the users only need to have the foobar-window open, as placative as possible...

looks like this (not finished) =>

integrating numeric clock?

Reply #3
replace

Code: [Select]
gr.GdiDrawText((h == 0 ? "00" : h < 10 ? "0" + h : h) + ":" +  (m < 10 ? "0" + m : m) + ":" + (s < 10 ? "0" + s : s), font, text_colour, 0, 0, ww, wh, 0x00000001 | 0x00000004 | 0x00000010 | 0x00000400 | 0x00000800);

with

Code: [Select]
gr.GdiDrawText("LOCAL TIME " + (h < 10 ? "0" + h : h) +  ":" +  (m < 10 ? "0" + m : m) + ":" + (s < 10 ? "0" + s : s), font, text_colour, 0, 0, ww, wh, 0x00000001 | 0x00000004 | 0x00000010 | 0x00000400 | 0x00000800);


then resize the panel so it wraps.

 

integrating numeric clock?

Reply #4
thx for the help!