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 801531 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

WSH Panel Mod

Reply #275
1.1.10 Beta 8 Uploaded
Fix crash when there's errors in script.


Downloaded this new version, but it still crashes on errors.
But just in some occasions, although I coudn't say which ones.

Moderation: Merged two posts.

WSH Panel Mod

Reply #276
@Harm:
Is there any Crashlogs?

WSH Panel Mod

Reply #277
What I get is a Microsoft Visual C++ Runtime Library popup showing "Runtime Error!" and than a foobar2000 crash.

WSH Panel Mod

Reply #278
Now it says "R6025 - Pure virtual function call"


WSH Panel Mod

Reply #280
@ojtioo: same error for me

WSH Panel Mod

Reply #281
I'm also getting an error. foobar crashed when I changed some code in a WSH panel, and it's made it to the foobar2000.cfg file, so I get the same crash whenever I start. There's no crash log unfortunately, just a runtime error message box.

WSH Panel Mod

Reply #282
@bismuth:
I've already replied in Br3tt's topic.

@TomBarlow:
Do you mind sending me the config file to analyze?

WSH Panel Mod

Reply #283
Two occasions on which crashes happen are a missing bracket and an infinite loop.

WSH Panel Mod

Reply #284
When running foobar2000.exe I get this in the console:

[blockquote]No source info
Error: WSH Panel Mod (HWND: 0x000309e0): Microsoft JScript runtime error:
Permission denied
Ln: 1375, Col: 1[/blockquote]

I am logged in as an administrator. However, when I run foobar2000.exe using "Run as administrator" user or if I grant all permissions to the Users group on the ..\foobar2000 folder level then I don't get this error.


Running foobar2000.exe with the following:
Windows 7
foo_uie_wsh_panel_mod 1.1.10 Beta 8
Xchange v3.5.1b by ~Br3tt


WSH Panel Mod

Reply #285
@ghettoCoolie :

nothing to do here, not a wsh bug, just an error because my jscript try to move a file and the system do not allow it.

maybe due to the UAC running (Vista or Seven) ?

(Xchange try to rename a option file in .../foobar2000/skins/xchange/settings/)

WSH Panel Mod

Reply #286
@ghettoCoolie :

nothing to do here, not a wsh bug, just an error because my jscript try to move a file and the system do not allow it.

maybe due to the UAC running (Vista or Seven) ?

(Xchange try to rename a option file in .../foobar2000/skins/xchange/settings/)


Thanks Falstaff. I'll try changing the permissions on just the settings folder then. I do have UAC turned on for Windows 7.

WSH Panel Mod

Reply #287
@Fallstaff:
The best way to store configs is storing them in the profile folder, WSH Panel Mod can achieve this by using fb.ProfilePath, I don't know if it's already supported by PSS/ELP, however, you can ask the author for adding them.

@Harm:
Can you tell me the error code/address?
You can use Inspector IIXII to generate more detailed crash info if possible.

WSH Panel Mod

Reply #288
is there a function that return the colour of a pixel ?

such as :

mouse_over_colour = GetPixelColor(x,y);

if not, could i request it ?

thanx by advance.

WSH Panel Mod

Reply #289
@Harm:
Can you tell me the error code/address?
You can use Inspector IIXII to generate more detailed crash info if possible.


Inspector IIXII doesn't give any results (except for a message "Timeout while waiting for debug event!"). Maybe this is because Foobar2000 doesn't freeze but just shuts down?

By the way: I am using Windows XP, Foobar2000 0.9.6.9 and WSH Panel Mod 1.1.10 beta 8

WSH Panel Mod

Reply #290
hello all -
  a question...  anyone have ideas about how to rotate an image by a set number of degrees?  i'm not the best with jscript, though i can hack my way through it.  i've looked and looked, and all i seem to find is a reference to the fact that the rotate capability in wsh is "totally broken."  that doesn't sound so good....  any ideas?

  thanks.
i'er heights

WSH Panel Mod

Reply #291
There is an angle argument in the draw image function, if you want to change it with time you just need to repaint the window every so often. Try this:

Code: [Select]
var angle=0;
var g_img = gdi.Image("path\\to\\image.jpg");
function on_paint(gr)
{
        gr.DrawImage(g_img, img_x, img_y, img_w, img_h, 0, 0, g_img.Width, g_img.Height,angle);
}
function on_playback_time(time)
{
    angle = 360 * fb.PlaybackTime / fb.PlaybackLength;
    window.Repaint();
}
I'm not sure how to rotate around a particular axis though.

T.P Wang: The problem was a missing } after one of my functions. Here's the bad code, the problem function is the playbackorder one, I was going to turn it into a playback order drop down menu, I hadn't seen the sample code for that at that point! I ended up downgrading and re-upgrading, and re-importing my scripts from backups (and fixing this code obviously!)

Code: [Select]
var dir = fb.FoobarPath+"\\images\\FOOTOR\\";
var bg = gdi.Image(dir+"btn_m.png");
var bgL = gdi.Image(dir+"btnbg_l.png");
var bgR = gdi.Image(dir+"btnbg_r.png");
var button_bg_hov = gdi.Image(dir+"btn_bg.png");
var button_bg_down = gdi.Image(dir+"btn_bg_d.png");
var cur_btn = null;
var act_btn = null;
var tooltip = window.CreateTooltip();
var menutoggle = false;

ButtonStates = {
normal: 0,
hover: 1,
down: 2
}

ShowButton = {
hide: 0,
show: 1
}

var ww = window.Width;
var wh = window.Height;

// Flags, used by Menu
var MF_SEPARATOR = 0x00000800;
var MF_ENABLED = 0x00000000;
var MF_GRAYED = 0x00000001;
var MF_DISABLED = 0x00000002;
var MF_UNCHECKED = 0x00000000;
var MF_CHECKED = 0x00000008;
var MF_STRING = 0x00000000;
var MF_POPUP = 0x00000010;
var MF_RIGHTJUSTIFY = 0x00004000;

//button function
function button(icon,func_onClick,x,tooltiptxt,state,show)
{
this.icon=gdi.Image(dir+icon+".png");
this.state=state ? state : ButtonStates.normal;
this.show=show ? show : ShowButton.show;
this.x=x;
this.func_onClick = func_onClick;
this.tooltiptxt=tooltiptxt;
this.containXY = function (x, y)
{
return (this.x <= x) && (x <= this.x + 23) && (0 <= y) && (y <= 20);
}
   
this.draw = function (gr)
{
if (this.show == ShowButton.hide){return;}
else
{
if(this.state == ButtonStates.normal)
{
gr.DrawImage(this.icon, this.x+3, 2, 16, 16, 0, 0, 16, 16);
}
else if(this.state == ButtonStates.hover)
{
gr.DrawImage(button_bg_hov, this.x, 0, 23, 20, 0, 0, 23, 20);
gr.DrawImage(this.icon, this.x+3, 2, 16, 16, 0, 0, 16, 16);
tooltip.Text=this.tooltiptxt;
tooltip.Activate();
}
else if(this.state == ButtonStates.down)
{
gr.DrawImage(button_bg_down, this.x, 0, 23, 20, 0, 0, 23, 20);
gr.DrawImage(this.icon, this.x+3, 2, 16, 16, 0, 0, 16, 16);
}
}
}
   
this.onClick = function ()
{
this.func_onClick && this.func_onClick();
}
}

function showhidebuttons()
{
if(fb.CursorFollowPlayback)
{
$buttons.cfp.show = ShowButton.hide;
$buttons.cfp_on.show = ShowButton.show;
}
else
{
$buttons.cfp_on.show = ShowButton.hide;
$buttons.cfp.show = ShowButton.show;
}
if(fb.PlaybackFollowCursor)
{
$buttons.pfc.show = ShowButton.hide;
$buttons.pfc_on.show = ShowButton.show;
}
else
{
$buttons.pfc_on.show = ShowButton.hide;
$buttons.pfc.show = ShowButton.show;
}
if(fb.PlaybackOrder==0)
{
$buttons.shuf_on.show = ShowButton.hide;
$buttons.rtrk_on.show = ShowButton.hide;
$buttons.rall_on.show = ShowButton.hide;
$buttons.rtrk.show = ShowButton.show;
}
else if(fb.PlaybackOrder==1)
{
$buttons.shuf_on.show = ShowButton.hide;
$buttons.rtrk_on.show = ShowButton.hide;
$buttons.rall_on.show = ShowButton.show;
$buttons.rtrk.show = ShowButton.hide;
}
else if(fb.PlaybackOrder==2)
{
$buttons.shuf_on.show = ShowButton.hide;
$buttons.rtrk_on.show = ShowButton.show;
$buttons.rall_on.show = ShowButton.hide;
$buttons.rtrk.show = ShowButton.hide;
}
else if(fb.PlaybackOrder==4)
{
$buttons.shuf_on.show = ShowButton.show;
$buttons.rtrk_on.show = ShowButton.hide;
$buttons.rall_on.show = ShowButton.hide;
$buttons.rtrk.show = ShowButton.hide;
}
}

function drawAllButtons(gr)
{
showhidebuttons();
for (var i in $buttons)
{
$buttons[i].draw(gr);
}
}

function chooseButton(x, y)
{
for (var i in $buttons)
{
if ($buttons[i].containXY(x, y) && $buttons[i].show != ShowButton.hide)
return $buttons[i];
}
   
return null;
}

function menu()
{
menutoggle = !menutoggle;
if(menutoggle)
{
var _basemenu = window.CreatePopupMenu();
var _stuff = window.CreatePopupMenu();
var _vis = window.CreatePopupMenu();
var ret;

_basemenu.AppendMenuItem(MF_STRING, 1, "KFJC");
_basemenu.AppendMenuItem(MF_STRING, 2, "Radio 4");
_basemenu.AppendMenuSeparator();
_basemenu.AppendMenuItem(MF_STRING, 3, "Last.fm");
_basemenu.AppendMenuItem(MF_STRING, 4, "Rate Your Music");
_basemenu.AppendMenuSeparator();
_basemenu.AppendMenuItem(MF_STRING | MF_POPUP, _stuff.ID, "Stuff");
_stuff.AppendMenuItem(MF_STRING, 5, "Open CD");
_stuff.AppendMenuItem(MF_STRING, 6, "MP3Tag");
_stuff.AppendMenuItem(MF_STRING, 7, "Album Art Downloader");
_basemenu.AppendMenuItem(MF_STRING | MF_POPUP, _vis.ID, "Visualisations");
_vis.AppendMenuItem(MF_STRING, 8, "Spectrogram");
_vis.AppendMenuItem(MF_STRING, 9, "Oscilloscope");
_vis.AppendMenuItem(MF_STRING, 10, "Spectrum");
_vis.AppendMenuItem(MF_STRING, 11, "Peak Meter");
_vis.AppendMenuItem(MF_STRING, 12, "VU Meter");

ret = _basemenu.TrackPopupMenu(-11, 19);

if (ret == 0)
return;

switch (ret)
{
case 1:
fb.RunContextCommandWithMetadb('Run service/KFJC',fb.IsPlaying?fb.GetNowPlaying():fb.GetFocusItem());
break;
case 2:
fb.RunContextCommandWithMetadb('Run service/Radio4',fb.IsPlaying?fb.GetNowPlaying():fb.GetFocusItem());
break;
case 3:
fb.RunContextCommandWithMetadb('Run service/Last.fm',fb.IsPlaying?fb.GetNowPlaying():fb.GetFocusItem());
break;
case 4:
fb.RunContextCommandWithMetadb('Run service/RateYourMusic',fb.IsPlaying?fb.GetNowPlaying():fb.GetFocusItem());
break;
case 5:
fb.RunMainMenuCommand('Open Audio CD...');
break;
case 6:
fb.RunContextCommandWithMetadb('Run service/MP3Tag',fb.IsPlaying?fb.GetNowPlaying():fb.GetFocusItem());
break;
case 7:
fb.RunContextCommandWithMetadb('Run service/AlbumArtDL',fb.IsPlaying?fb.GetNowPlaying():fb.GetFocusItem());
break;
case 8:
fb.RunMainMenuCommand('Spectrogram');
break;
case 9:
fb.RunMainMenuCommand('Oscilloscope');
break;
case 10:
fb.RunMainMenuCommand('Spectrum');
break;
case 11:
fb.RunMainMenuCommand('Peak Meter');
break;
case 12:
fb.RunMainMenuCommand('VU Meter');
break;
default:
fb.trace("No Command");
break;
}
}
else
return;
}

function playbackorder()
{
var _basemenu = window.CreatePopupMenu();
var ret;

_basemenu.AppendMenuItem(MF_STRING, 1, "KFJC");
_basemenu.AppendMenuItem(MF_STRING, 2, "Radio 4");
_basemenu.AppendMenuItem(MF_STRING, 3, "Last.fm");
_basemenu.AppendMenuItem(MF_STRING, 4, "Rate Your Music");

ret = _basemenu.TrackPopupMenu(-11, 19);

if (ret == 0)
return;

switch (ret)
{
case 1:
fb.RunContextCommandWithMetadb('Run service/KFJC',fb.IsPlaying?fb.GetNowPlaying():fb.GetFocusItem());
break;
case 2:
fb.RunContextCommandWithMetadb('Run service/Radio4',fb.IsPlaying?fb.GetNowPlaying():fb.GetFocusItem());
break;
case 3:
fb.RunContextCommandWithMetadb('Run service/Last.fm',fb.IsPlaying?fb.GetNowPlaying():fb.GetFocusItem());
break;
case 4:
fb.RunContextCommandWithMetadb('Run service/RateYourMusic',fb.IsPlaying?fb.GetNowPlaying():fb.GetFocusItem());
break;
case 5:
fb.RunMainMenuCommand('Open Audio CD...');
break;
case 6:
fb.RunContextCommandWithMetadb('Run service/MP3Tag',fb.IsPlaying?fb.GetNowPlaying():fb.GetFocusItem());
break;
case 7:
fb.RunContextCommandWithMetadb('Run service/AlbumArtDL',fb.IsPlaying?fb.GetNowPlaying():fb.GetFocusItem());
break;
default:
fb.trace("No Command");
break;
}

$buttons = {
cfp:    new button('cfp'      ,function() {fb.CursorFollowPlayback=true;},0,"Cursor Follows Playback (off)"),
cfp_on: new button('cfp_on'    ,function() {fb.CursorFollowPlayback=false;},0,"Cursor Follows Playback (on)"),
pfc:    new button('pfc'      ,function() {fb.PlaybackFollowCursor=true;},23,"Playback Follows Cursor (off)"),
pfc_on: new button('pfc_on'    ,function() {fb.PlaybackFollowCursor=false;},23,"Playback Follows Cursor (on)"),
rtrk:  new button('default_on',function() {fb.PlaybackOrder=2;},46,"Default"),
rtrk_on:new button('rep_trk_on',function() {fb.PlaybackOrder=1;},46,"Repeat Track"),
rall_on:new button('rep_all_on',function() {fb.PlaybackOrder=4;},46,"Repeat All"),
shuf_on:new button('shuff_on'  ,function() {fb.PlaybackOrder=0;},46,"Shuffle Tracks"),
menu:  new button('menu2'    ,function() {menu()},69,"Menu")
}

function on_paint(gr)
{
gr.DrawImage( bg, 0, 0, window.Width, bg.Height, 0, 0, bg.Width, bg.Height);
drawAllButtons(gr);
}

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

function on_mouse_lbtn_down(x,y)
{
cur_btn = chooseButton(x, y);
if(cur_btn)
{
cur_btn.state=ButtonStates.down;
}
act_btn = cur_btn;
window.Repaint();
}
function on_mouse_move(x, y)
{
cur_btn = chooseButton(x, y);
if(cur_btn)
{
if(cur_btn.state!=ButtonStates.down&&!act_btn)
{
cur_btn.state=ButtonStates.hover;
}
for(var i in $buttons)
{
if($buttons[i] != cur_btn)
{
$buttons[i].state=ButtonStates.normal;
}
}
if(cur_btn==act_btn)
{
cur_btn.state=ButtonStates.down;
}
}
else
{
for(var i in $buttons)
{
$buttons[i].state=ButtonStates.normal;
}

}
window.Repaint();
}
function on_mouse_lbtn_up(x, y)
{
if (cur_btn&&act_btn==cur_btn)
{
cur_btn.onClick();
cur_btn = chooseButton(x, y);
showhidebuttons();
cur_btn.state=ButtonStates.hover;
}
act_btn = null;
window.Repaint();
}
function on_mouse_leave()
{
for (var i in $buttons)
{
$buttons[i].state=ButtonStates.normal;
}
window.Repaint();
tooltip.Deactivate();
menutoggle = false;
}
function on_cursor_follow_playback_changed(state)
{
window.Repaint();
}
function on_playback_follow_cursor_changed(state)
{
window.Repaint();
}
function on_playback_order_changed(new_order_index)
{
window.Repaint();
}

WSH Panel Mod

Reply #292
@TomBarlow -
  thanks for the lead, i just discovered the angle component of the gdi.Drawimage - still trying to figure out how to set x,y coordinates for the center of rotation....  thanks for the code!

-lljk
i'er heights

WSH Panel Mod

Reply #293
latest beta of WSH panel mod is stable. 0 crash encountered

but in the script editor, when i click in text area, sometimes (often!) an overlap button appear many times



could you fix it please. Thanx by advance.

WSH Panel Mod

Reply #294
hi -
  this may be a simple (dumb) question, but i'm having trouble repainting the window on a track change to show the album art.  i define the album art like this:
Code: [Select]
var coverpath = fb.TitleFormat("$replace(%path%,%filename_ext%,folder.jpg,)").Eval(true);
var cover = gdi.image(coverpath);
var coversize = 405
...i know this is not the best way to define the album art, but it works...    so at the end of the script i have this:
Code: [Select]
function on_playback_new_track(metadb) {
window.Repaint();
}
doesn't work....  i think i need to re-evaluate the cover variables within the playback_new_track function, and i've tried in various ways, but i can't seem to make it work.  any ideas?

p.s.  as you can probably tell by the code, i'm no programmer - and honestly the .txt files that come with the wsh .dll haven't been very easy for me to understand.  i've read a bunch on jscript, but i have a hard time translating the info in the .txt files into actual functioning code...  is there any other documentation out there that lists the functions and "fields" for the wsh panel?

 thanks in advance...
  j
i'er heights

WSH Panel Mod

Reply #295
hmmm, I´m not an expert for WSH panel but for the title format doesn´t it have to be '$replace(%path%,%filename_ext%,)folder.jpg' (or '$replace(%path%,%filename_ext%,folder.jpg)' instead of your code?

at least that´s what I always use in such cases...

WSH Panel Mod

Reply #296
That's not the problem (his TF-code should still work, although it has one comma too much)
The problem seems to be that he calls the variables global instead of an event.

@Iljk
Create the variables like this:
(global, means on top of your script)
var coverpath, cover;
var coversize = 405;

and then in on_playback_new_track:
function on_playback_new_track(metadb) {
coverpath = fb.TitleFormat("$replace(%path%,%filename_ext%,folder.jpg)").Eval(true);
cover = gdi.Image(coverpath);
window.Repaint();
}

or create them in on_paint, for instance:
var coverpath = fb.TitleFormat("$replace(%path%,%filename_ext%,folder.jpg)").Eval(true);
var cover = gdi.Image(coverpath);
var coversize = 405

WSH Panel Mod

Reply #297
You need to reevaluate the coverpath each time the track changes, so put

coverpath = fb.TitleFormat("$replace(%path%,%filename_ext%,folder.jpg,)").Eval(true);
cover = gdi.image(coverpath);

inside the on_playback_new_track as well.

WSH Panel Mod

Reply #298
With the second method?
Not necessary since he already uses window.Repaint() in on_playback_new_track
So he could still creates the variables in on_paint instead of global.

WSH Panel Mod

Reply #299
Sorry I hadn't seen your post when I posted. But yeah you're right defining things inside on_paint would work.