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: WSH Panel Mod (Read 801603 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

WSH Panel Mod

Reply #200
This might be a dumb question, but how do I access extended variables via jscript? I tried fb.varname varname and %varname% and neither did work :/
fb.Titleformat("%varname%").Eval(true);

WSH Panel Mod

Reply #201
worked, thanks!

WSH Panel Mod

Reply #202
Two questions.

1: Is there a way to read Windows system colors via this component?

2: Is there a way to get a metadb handle for multiple selected tracks? GetFocusItem() seems to just grab the last track selected in a range.

WSH Panel Mod

Reply #203
@DocBeard

for (1) I use this:

Code: [Select]
function Syscolor(color_n) {
    var Shell = new ActiveXObject("WScript.Shell");
    var tempc;
    tempc = Shell.RegRead("HKEY_CURRENT_USER\\Control Panel\\Colors\\" + color_n).split(" ");
    return (0xff000000|(tempc[0]<<16)|(tempc[1]<<8)|(tempc[2]));
}


@Anyone

I'm having a weird trouble with a panel, at Foobar2000 startup there's nothing drawn on it, I need to right-click->configure->OK to have it working right (that's the strange part because it WORKS as it should and no errors thrown at the console until I close Foobar)
<insert signature here>

WSH Panel Mod

Reply #204
@Anyone

I'm having a weird trouble with a panel, at Foobar2000 startup there's nothing drawn on it, I need to right-click->configure->OK to have it working right (that's the strange part because it WORKS as it should and no errors thrown at the console until I close Foobar)
This usually happens, when you are drawing an object which depends on the width and/or height of the panel and you are not getting the corresponding values in the on_size() event (see no. 6 of notes & hints in the first post)

WSH Panel Mod

Reply #205
@fbuser

OK, that did the trick!
<insert signature here>

WSH Panel Mod

Reply #206
I've quickly gone through the txt files and this thread and have a question
Is it possible to create a button in WSH panel that can hide/show other panels in PSS?
to me looks like it's not possible, but i just wanna double check with you guys!

Thanks


WSH Panel Mod

Reply #208
QUESTION:

Is it normal for GDIDrawText to fail drawing some characters?
It appears that '&' is one of those chars.

Look at this:



The text is "Day & Age". The blue rectangle uses CalcTextWidth to get its width plus a padding of 3 px, judging by the image, CalcTextWidth measures the '&' but GDIDrawText just fails to draw it.

How can I stop that behaviour?

- - - - -

Edit: forgot to add the original text.
<insert signature here>

WSH Panel Mod

Reply #209
@DocBeard:
Quote
2: Is there a way to get a metadb handle for multiple selected tracks? GetFocusItem() seems to just grab the last track selected in a range.

No.

@xbullethammer:
try this pre-defined variable in Flags.txt:
DT_NOPREFIX

WSH Panel Mod

Reply #210
WSH Panel Mod 1.1.9 Released.

WSH Panel Mod

Reply #211
@T.P Wang

Thanks for the new version, but I get infinite loop error messages at startup. The script works well, after I reapply it.
I've noticed that error messages occur when the system is too busy and it takes foobar too long to start. Is it a bug?


WSH Panel Mod

Reply #213
@mxmten:
You can increase value of timeout in fb2k Preference -> WSH Panel Mod. The max value is 180 seconds.

WSH Panel Mod

Reply #214
Is there a list of all possible foobar2000 commands?
(Things like fb.playbacktime and stuff)

And how do I get things like the song's title, year and artist into WSH Mod?

WSH Panel Mod

Reply #215
I figured it out, thanks:

Commands are in Interfaces.txt in the download package.

Song's stuff works like this:

var artist = fb.titleformat("%artist%");
-> artist(eval)

WSH Panel Mod

Reply #216
I have a difficult question: With Panel Stack Splitter (PSS), we can access the song's metadata, too. But the difference is that after stopping a song, PSS still returns the song's metadata while WSH Panel Mod's Eval() function does not. I'd like to be able to return metadata of the stopped song with WSH Panel Mod, too. Is this possible?

Even after not only stopping the song but additionally restarting foobar2000, PSS still returns all metadata of the formerly stopped song (I assume resuming has to be enabled). Would be great if there's a way to achieve this with WSH Panel Mod, too.

WSH Panel Mod

Reply #217
i've just been messing around and i've managed to modify the included tooltips sample to work with images instead of captions. that's working fine.

but now i'm stuck. what i'd like to do is have hover images as well as the tooltips. i just have no idea how to modify the code to do that. 

this is what i have so far.....

Code: [Select]
// Please do not create more than one tooltip in one panel
var g_tooltip = window.CreateTooltip();
var g_down = false;

var btn_down = null;
var cur_btn = null;

// ------------------------------
//    Class `SampleButton'
// ------------------------------
function SampleButton(x, y, w, h, func, tiptext, img)  {
// 'Constructor' stuff
this.left = x;
this.top = y;
this.w = w;
this.h = h;
this.right = x + w;
this.bottom = y + h;
this.func = func;
this.tiptext = tiptext;
this.img = gdi.image(fb.FoobarPath + "Images\\simples\\" + img + ".png");

//hover image. maybe?
this.img_h = gdi.image(fb.FoobarPath + "Images\\simples\\" + img + "_h.png");

// Estimate whether the coordinate is in this button
this.traceMouse = function (x, y) {
return (this.left < x) && (x < this.right) && (this.top < y) && (y < this.bottom);
}

this.draw = function (gr) {
gr.DrawImage(this.img,this.left, this.top, this.w, this.h, 0, 0, this.w, this.h);
}

this.onClick = function () {
this.func && this.func(x,y);
}

this.onMouseIn = function() {
// Update tooltip text
g_tooltip.Text = this.tiptext;
g_tooltip.Activate();
}

this.onMouseOut = function() {
// Hide tooltip
g_tooltip.Deactivate();
}
}

function buttonsDraw(gr) {
for (i in SampleButtons) {
SampleButtons[i].draw(gr);
}
}

function buttonsTraceMouse(x, y) {
var btn = null;

for (i in SampleButtons) {
if (SampleButtons[i].traceMouse(x, y) && !btn)
btn = SampleButtons[i];
}

return btn;
}


// ------------------------------
// --- APPLICATION START
// ------------------------------

function on_mouse_move(x, y) {
var btn = buttonsTraceMouse(x, y);

if (btn != cur_btn) {
cur_btn && cur_btn.onMouseOut();
btn && btn.onMouseIn();
}

if (btn != btn_down) {
btn_down = null;
}

cur_btn = btn;
}

function on_mouse_lbtn_down(x, y) {
g_down = true;
btn_down = cur_btn;
}

function on_mouse_lbtn_up(x, y) {
if (cur_btn) {
if (btn_down == cur_btn)
cur_btn.onClick(x, y);
}

g_down = false;
}

function on_paint(gr) {
buttonsDraw(gr);
}

function on_playback_new_track() {
var bw = 24;
var bh = 20;

var WshShell = new ActiveXObject("WScript.Shell");
var wiki = fb.TitleFormat("http://en.wikipedia.org/wiki/$replace(%artist%,' ','_')").Eval(true);
var lastfm = fb.TitleFormat("http://www.last.fm/music/$replace(%artist%,' ','+')").Eval(true);

SampleButtons = {
but1: new SampleButton(0,0,bw,bh, function(){fb.RunMainMenuCommand("View/Columns playlist/Activate now playing");}, "Activate now playing","now playing"),
but2: new SampleButton(bw,0,bw,bh, function(){fb.RunContextCommand("Open Containing Folder");}, "Open Containing Folder","open"),
but3: new SampleButton(bw*2,0,bw,bh, function(){WshShell.run(wiki);}, wiki,"wiki"),
but4: new SampleButton(bw*3,0,bw,bh, function(){WshShell.run(lastfm);}, lastfm,"lastfm")
};

CollectGarbage();
}

on_playback_new_track();

// --- APPLICATION END

any ideas?

WSH Panel Mod

Reply #218
I am trying to figure out how to have the current playlist's total length  (in seconds, minutes, days, etc.) as well as it's size (MB, GB, etc.,) but just by reading through the various text file I cannot seem to figure out how to do it. :s


WSH Panel Mod

Reply #220
- I would also like to make a WSH panel which has an imagebutton to simulate a keystroke (arrow left or right) to trigger the cover flow of a Chronflow panel. Is that possible and how?


can anybody help on this, please?

I mean, basically, how to simulate keystrokes in WSH panel?

WSH Panel Mod

Reply #221
@vogliadicane:

The only way I think is to have your button executing a foo_run command which will execute an autohotkey script which can finally send whatever to the foobar2000 window.

It's weird btw.
<insert signature here>

WSH Panel Mod

Reply #222
@vogliadicane:

The only way I think is to have your button executing a foo_run command which will execute an autohotkey script which can finally send whatever to the foobar2000 window.

It's weird btw.


that´s an idea, I´ll try this. Thanks!

Btw I want this, because I use Foobar on a touch screen system where the (hardware) keyboard is most of the time not used. There´s an on-screen keyboard but a solution with buttons directly in foobar seems more elegant for me

WSH Panel Mod

Reply #223
Hello.
Which function I should add in WSH script to change cursor image in seek bar on mouse cursor "coming"? I found on_mouse_leave function but I can't find "reverse" ("backward") function.

P.S. Execuse me for my poor english...

WSH Panel Mod

Reply #224
@T.P Wang: there is a flicker issue when transparency enabled

on track change or on init, all the WSH panel content flickers 2 seconds (maybe ~4 flip flop very quickly, then a small pause, then a last flicker (~2 times))

no pb if transparency is OFF

any idea on how to fix this ugly thing ?

Thanx by advance.