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 script discussion/help (Read 1375578 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

Re: WSH Panel Mod script discussion/help

Reply #4500
Quote
[W]hat does WSH stand for?
Windows Script Host.

Re: WSH Panel Mod script discussion/help

Reply #4501
Thank you to everyone for the really helpful answers :) I also figured out how to change tab names (it was the "Use custom title" setting… duh!) So all my questions are answered now, thank you. :)

Re: WSH Panel Mod script discussion/help

Reply #4502
Please help me with great animated buttons coded by user "maklaud from http://foobar2000.ru",
Code: [Select]
// ==PREPROCESSOR==
// @name "Pulsar Buttons"
// ==/PREPROCESSOR==

var BackColor = 0xff202020;
var FP = fb.FoobarPath + "themes\\Pulsar Buttons\\";
var P = {
    STOP:gdi.Image(FP+"stop.png"),
    PREV:gdi.Image(FP+"prev.png"),
    NEXT:gdi.Image(FP+"next.png"),
    PLAY:gdi.Image(FP+"play.png"),
    PAUS:gdi.Image(FP+"pause.png")};
var BT = 6;             //всего позиций кнопок // number of buttons
var FT = 9;             //всего кадров в пикче // frames in picture
var IW = 60;            //ширина пикчи // weight of picture
var IH = 540;           //высота пикчи // height of picture
var FPS = 30;           //скорость анимации (кадров/сек) // animation FPS
var FH = IH/FT;         //высота кадра в пикче // height of frame
var TimBefSeek = 400;   //пройдёт перед перемоткой, мс. // Time before FW ms
var IntSeek = 200;      //время интервала перемотки, мс. // Time interval FW
var TimSeek = 5;        //перемотать на, сек. // time FW
var N = {STOP:2, PREV:3, PLAY:4, PAUS:4, NEXT:5}; //порядок кнопок (№ п/п) // buttons order
var f = {STOP:1, PREV:1, PLAY:1, PAUS:1, NEXT:1}; //стартовый кадр // Starting frame
var m = {};
var b = {};
var FrameIntrvl = window.setInterval(Frame, 1000/FPS), BackAheaInt, PrevNextTmt;
var repaint = 0;

function on_paint(gr) {
    gr.FillSolidRect(0, 0, ww, wh, BackColor);
    gr.DrawImage(P.STOP, NTP(N.STOP), 0, wh, wh, 0, FTP(f.STOP), IW, FH);
    gr.DrawImage(P.PREV, NTP(N.PREV), 0, wh, wh, 0, FTP(f.PREV), IW, FH);
    gr.DrawImage(P.NEXT, NTP(N.NEXT), 0, wh, wh, 0, FTP(f.NEXT), IW, FH);
    if (fb.IsPaused || !fb.IsPlaying) {
        gr.DrawImage(P.PLAY, NTP(N.PLAY), 0, wh, wh, 0, FTP(f.PLAY), IW, FH);
    } else {
        gr.DrawImage(P.PAUS, NTP(N.PAUS), 0, wh, wh, 0, FTP(f.PAUS), IW, FH);
    }
}

function on_mouse_move(x,y) {
    onY= y<wh&&y>0 ? 1 : 0;
    m.STOP = x > NTP(N.STOP) && x < NTP(N.STOP)+wh && onY ? 1 : 0;
    m.PREV = x > NTP(N.PREV) && x < NTP(N.PREV)+wh && onY ? 1 : 0;
    m.NEXT = x > NTP(N.NEXT) && x < NTP(N.NEXT)+wh && onY ? 1 : 0;
    if (fb.IsPaused || !fb.IsPlaying) {
        m.PLAY = x > NTP(N.PLAY) && x < NTP(N.PLAY)+wh && onY ? 1 : 0;
        m.PAUS = 0;
    } else {
        m.PAUS = x > NTP(N.PAUS) && x < NTP(N.PAUS)+wh && onY ? 1 : 0;
        m.PLAY = 0;
    }
}

function on_mouse_leave() {m = {STOP:0, PREV:0, PLAY:0, PAUS:0, NEXT:0};}

function on_mouse_lbtn_down(x,y) {
    b = {STOP:m.STOP, PREV:m.PREV, PLAY:m.PLAY, PAUS:m.PAUS, NEXT:m.NEXT};
    if (b.PREV||b.NEXT) {PrevNextTmt = window.SetTimeout(PrevNextAbort, TimBefSeek)}
}

function PrevNextAbort() {
    b = {PREV:0, NEXT:0};
    BackAheaInt = window.SetInterval(function Back() {
        if (m.PREV) {fb.PlaybackTime -= TimSeek};
        if (m.NEXT) {fb.PlaybackTime += TimSeek};
    }, IntSeek);
}

function on_mouse_lbtn_up() {
    window.ClearInterval(BackAheaInt);
    window.ClearTimeout(PrevNextTmt);
    if (b.STOP && m.STOP) {fb.Stop()};
    if (b.PREV && m.PREV) {fb.Prev()};
    if (b.NEXT && m.NEXT) {fb.Next()};
    if (b.PLAY && m.PLAY || b.PAUS && m.PAUS) {fb.PlayOrPause()};
    b = {STOP:0, PREV:0, PLAY:0, PAUS:0, NEXT:0};
}

function Frame() {
    f.STOP = CalcFrame(m.STOP, b.STOP, f.STOP);
    f.PREV = CalcFrame(m.PREV, b.PREV, f.PREV);
    f.NEXT = CalcFrame(m.NEXT, b.NEXT, f.NEXT);
    f.PLAY = CalcFrame(m.PLAY, b.PLAY, f.PLAY);
    f.PAUS = CalcFrame(m.PAUS, b.PAUS, f.PAUS);
    if (repaint){window.Repaint();}
    repaint= f.STOP!=1||f.PREV!=1||f.NEXT!=1||f.PLAY!=1||f.PAUS!=1 ? 1 : 0;
}

function CalcFrame(m,b,f) {return m?b?FT:f<FT-1?f+1:FT-1:f<=1?1:f<FT&&f>7?f-3:f-1;}

function NTP(n) {return n*(ww/(BT+1))-wh/2;}

function FTP(f) {return (f-1)*FH;}

function on_colors_changed() {window.Repaint();}

function on_size() {
    ww = window.Width;
    wh = window.Height;
}
I want to make 4 SWITCHING buttons for 4 DSP presets. It would be wonderful if the script saves the state at the open / close of the foobar2000.
Script in attachment:
PEACE, Me.

Re: WSH Panel Mod script discussion/help

Reply #4503
Please help me with great animated buttons coded by user "maklaud from http://foobar2000.ru",

I want to make 4 SWITCHING buttons for 4 DSP presets. It would be wonderful if the script saves the state at the open / close of the foobar2000.
I think you'd have to start with:
- creating/replacing button images (custom made), unless you don't mind changing DSP presets with the 'next' or 'play' button :-)
- replacing current button commands - fb.Stop or fb.PlayOrPause etc. with DSP presets commands, something like: fb.RunMainMenuCommand("Playback/DSP settings/preset1")?
- removing some conditions related to play/pause/stop

Re: WSH Panel Mod script discussion/help

Reply #4504
Please help me with great animated buttons coded by user "maklaud from http://foobar2000.ru",

I want to make 4 SWITCHING buttons for 4 DSP presets. It would be wonderful if the script saves the state at the open / close of the foobar2000.
I think you'd have to start with:
- creating/replacing button images (custom made), unless you don't mind changing DSP presets with the 'next' or 'play' button :-)
- replacing current button commands - fb.Stop or fb.PlayOrPause etc. with DSP presets commands, something like: fb.RunMainMenuCommand("Playback/DSP settings/preset1")?
- removing some conditions related to play/pause/stop
Sure, I made IMG's,, and know how to change commands, but I want SWITCHING buttons and I'm not a programmer.
Switching means one buttons is ON state other buttons goes OFF like buttons on old radio. Also script need to can read state of current preset for Foobar close/open.
PEACE, Me.

Re: WSH Panel Mod script discussion/help

Reply #4505
Sure, I made IMG's,, and know how to change commands, but I want SWITCHING buttons and I'm not a programmer.
Switching means one buttons is ON state other buttons goes OFF like buttons on old radio. Also script need to can read state of current preset for Foobar close/open.
I'm sorry I didn't know what you knew ;-).

If I were you I'd look for a script that achieves effect you're seeking and try to copy it. Searching for "wsh panel mod fb.RunMainMenuCommand("Playback/DSP settings" brings this site http://foobar2000.ru/forum/viewtopic.php?t=1878&start=260 which consists a DSP settings switch script with highlighting (the one with DSP commands) Maybe it can be of some use.

Re: WSH Panel Mod script discussion/help

Reply #4506
Hi,

Can anybody please share a script which can be used to update tags based on playback time?

Re: WSH Panel Mod script discussion/help

Reply #4507
I very much doubt you'll get a decent answer with a vague question like that on a thread of an obsolete component.

Re: WSH Panel Mod script discussion/help

Reply #4508
Something very simple that assumes it can tag any file it plays and has no error checking. You'd want to add code so that it skips streams etc.

Code: [Select]
var target_time = 0;
var elapsed_time = 0;

function on_playback_new_track() {
    elapsed_time = 0;
    target_time = Math.floor(fb.PlaybackLength / 2); //do something after half the track has played. of course this can be modified to any value you like, in seconds
}

function on_playback_time() {
    elapsed_time++;
    if (elapsed_time == target_time) {
        var m = fb.GetNowPlaying();
        m.UpdateFileInfoSimple("TAG_NAME", "TAG_VALUE"); //don't use %% around TAG_NAME
    }
}

Re: WSH Panel Mod script discussion/help

Reply #4509
@marc2003,

Thank you very much. It works perfectly. Sorry to bother you with one more question. I want to use it to track the skip count. How to set the current value of a tag as variable? I wanted to use something like this.

Code: [Select]
var current_skip_count = ?  // How to set current value of tag "SKIP_COUNT" as variable?
m.UpdateFileInfoSimple("SKIP_COUNT", current_skip_count +1);

Thanks again.

Re: WSH Panel Mod script discussion/help

Reply #4510
Code: [Select]
var current_skip_count = parseInt(fb.TitleFormat("$if2(%SKIP_COUNT%,0)").Eval());

Re: WSH Panel Mod script discussion/help

Reply #4511
@marc2003 ,

Perfect!!!. Thank you very much. :)

Re: WSH Panel Mod script discussion/help

Reply #4512
Sorry if this is the wrong place to post this, but I am new to the site and have not mastered the navigation.

I am looking for a script for WSH Panel mod or Jscript Panel that will display only the playtime remaining time for the audio file that is playing. If you have one you're willing to share or can point me in the right direction, I'd be grateful.

Thanks for your help -

Re: WSH Panel Mod script discussion/help

Reply #4513
Using WSH panel mod for this seems a bit overkill but you can try this... (will work in JScript Panel as well)

Code: [Select]
var font = gdi.Font("Segoe UI", 18, 1);

var colours = {
    background : RGB(255, 255, 255),
    text : RGB(0, 0, 0)
};
var tfo = fb.TitleFormat("-%playback_time_remaining%");
//////////////////////////////////////////////////////////////////////////////////////
var DT_LEFT = 0x00000000;
var DT_CENTER = 0x00000001;
var DT_RIGHT = 0x00000002;
var DT_VCENTER = 0x00000004;
var DT_WORDBREAK = 0x00000010;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;
var DT_END_ELLIPSIS = 0x00008000;

var LEFT = DT_VCENTER | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX;
var RIGHT = DT_VCENTER | DT_RIGHT | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX;
var CENTRE = DT_VCENTER | DT_CENTER | DT_END_ELLIPSIS | DT_CALCRECT | DT_NOPREFIX;

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

function on_paint(gr) {
    gr.FillSolidRect(0, 0, window.Width, window.Height, colours.background);
    if (fb.IsPlaying)
        gr.GdiDrawText(tfo.Eval(), font, colours.text, 0, 0, window.Width, window.Height, CENTRE);
}

function on_playback_time() {
    window.Repaint();
}

Re: WSH Panel Mod script discussion/help

Reply #4514
Thank you very much!! Perfect!!!




Re: WSH Panel Mod script discussion/help

Reply #4518
If anyone else came for this old function:
Code: [Select]
if (fb.IsPlaying)
    t.draw(gr)
else
    p.centre_text(gr, "No tracks played.", p.normal_font, p.textcolour, 0, 0, t.w, t.h);

also, you need to add this extra bit of code not inside any other functions.

Code: [Select]
function on_playback_starting() {
    window.Repaint();
}

function on_playback_stop() {
    window.Repaint();
}

Consider update to this component instead : https://github.com/marc2k3/foo_jscript_panel/wiki
(You need to update to foobar2000 v1.4 beta to use it)
after installing the new component, add the Utility>jScript Panel in any place you want in the Default User Interface
then copy paste the code from that plugin's samples/complete/text reader.txt into new jScript Panel
then edit the on_paint function as below
Code: [Select]
function on_paint(gr) {
    panel.paint(gr);
gr.DrawLine(text.x, text.y + 1, text.x + text.w, text.y + 1, 1, panel.colours.highlight);
    if (fb.IsPlaying) {
        gr.GdiDrawText(text.header_text(), panel.fonts.title, panel.colours.highlight, LM, 0, panel.w - (LM * 2), TM, LEFT);
        text.paint(gr);
    }else{
        gr.GdiDrawText("No tracks played.", panel.fonts.title, panel.colours.highlight, LM, 0, panel.w - (LM * 2), TM, LEFT);
    }
}
then add this extra bit of code not inside any other functions.
Code: [Select]
function on_playback_starting() {
    window.Repaint();
}

function on_playback_stop() {
    window.Repaint();
}
and now you get a newer panel with same old behaviour (from 3 years ago) preserved...

Re: WSH Panel Mod script discussion/help

Reply #4519
Hello,

I want to hover a PBO button but no luck so far. Maybe someone will help me with this?

Code: [Select]
b.buttons.pbo = new button(0, 0, 35, 35, {normal : fb.FoobarPath+"Images\\PBO\\" + PBOArray[plman.PlaybackOrder] + ".png"}, function () {
pbo_menu();
}, "Playback Order");
window.RepaintRect(b.buttons.pbo.x, b.buttons.pbo.y, b.buttons.pbo.w, b.buttons.pbo.h);
}


It's working now.....

[code)b.buttons.pbo = new button(0, 0, 35, 35, {normal : fb.FoobarPath+"Images\\PBO\\" + PBOArray[plman.PlaybackOrder] + ".png", hover : fb.FoobarPath+"Images\\PBO\\1\\" + PBOArray[plman.PlaybackOrder] + ".png"}, function () {
      pbo_menu();
   }, "Playback Order");
   window.RepaintRect(b.buttons.pbo.x, b.buttons.pbo.y, b.buttons.pbo.w, b.buttons.pbo.h);
)[/code]

 

Re: WSH Panel Mod script discussion/help

Reply #4520
Hi guys,
All of a sudden the foo_uie_wsh_panel_mod component keeps crashing (using the DarkOne v3.1 skin by tedgo).
What can be wrong?

Re: WSH Panel Mod script discussion/help

Reply #4521
Hi guys,
All of a sudden the foo_uie_wsh_panel_mod component keeps crashing (using the DarkOne v3.1 skin by tedgo).
What can be wrong?


Nevermind, I fixed the problem.

Re: WSH Panel Mod script discussion/help

Reply #4522
i'm trying to improve my copy of foobar (+ wsh panel mod) (JScript)
this is very important for me. several days were spent on this, some partial success was achieved
but this is the point where i ask you for the help

is it possible to get the following?:

1) selected tracks' total length (preferably with milliseconds) (preferably with minutes instead of hours+minutes)
examples: 3:50.760 or 11:39.413 or 72:03.695 or 0:00.000

2) total length of all tracks in the active playlist (preferably with milliseconds) (preferably with minutes instead of hours+minutes)
examples: 7:41.480 or 50:45.264 or 72:03.695 or 112:53.001 or 0:00.000

3) total quantity of tracks in the active playlist
examples: 1 or 15 or 3625 or 0
%_playlist_total% doesn't work

i don't have enough knowledge to create the 3 necessary separate scripts
there are some less important questions but i decided to focus on the main things at the moment
thank you for reading this. i will be grateful for the help

Re: WSH Panel Mod script discussion/help

Reply #4523
i'm trying to improve my copy of foobar (+ wsh panel mod) (JScript)

Depending on which **panel component you are using, you should find a sample script "status bar + volume.txt" which has the foundation of what you are looking for. It will be much easier to modify than starting over.

%profile%\user-components\  **foo_jscript_panel  \samples\complete

Re: WSH Panel Mod script discussion/help

Reply #4524
i use: foobar (0.9.6.4), columns ui (0.3.6.4), wsh panel (uie) (0.7.2), wsh panel mod (1.2.1)

i couldn't find a sample script "status bar + volume.txt"

when mentioning "JScript", i was just trying to say that i add the code here:
right click -> configure -> WSH panel mod configuration -> script engine: JScript

samples from this page gave no help (as well as this topic)
the %_length% command is also not the solution