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

WSH Panel Mod

Reply #125
@2E7AH:
If you feel hard to translate JScript into VBScript, just translate VBScript into JScript, it's easy.
e.g:
VBScript
Code: [Select]
Function EjectByDriveSpecifier(Spec)
SET oWMP = CreateObject("WMPlayer.OCX.7")
SET oCDRoms = oWMPlayer.cdromCollection

If oCDRoms.Count >= 1 Then
For i = 0 To oCDRoms.Count - 1
If oCDRoms.Item(i).driveSpecifier = Spec Then
fb.trace "Ejecting", Spec, "..."
                oCDRoms.Item(i).Eject
End If
Next
End If
End Function


EjectByDriveSpecifier("I:")

JScript
Code: [Select]
function ejectByDriveSpec(spec) {
var wmp = new ActiveXObject("WMPlayer.OCX.7");
var roms = wmp.cdromCollection;

if (roms.Count >= 1) {
for (var i = 0; i < roms.Count; i++) {
if (roms.Item(i).driveSpecifier == spec) {
fb.trace("Ejecting", spec, "...");
roms.Item(i).Eject();
}
}
}
}

ejectByDriveSpec("I:");

WSH Panel Mod

Reply #126
@AngryWolf:
Please use codebox to wrap up your script...

@Falstaff:
I think it's because PSS draws background after WSH Panel Mod refresh its background in "Pseudo transparent" mode.
You can try the following, to make sure WSH Panel Mod refresh its background after PSS have drawn background (It's not due to the optimization of WM_PAINT message) :

...
// draw background here...
$imageabs()...
$drawimage()...
...
// at last, use $movepanel_c()
$movepanel_c(WSH,...)


WSH Panel Mod

Reply #127
If you feel hard to translate JScript into VBScript, just translate VBScript into JScript, it's easy.

Ok, thanks.
It seems that it is straight-forward. I tried something similar but witout success, so that's why I asked.
In your example both languages seems friendly, but that's not how I feel about them

My code is like your example - for ejecting and double that function for closing, and if you are familiar with the problem, do you know of some way to close CD tray if it is opened (this will require information if the CD is open or not)
Mainly because I want to do it with only one "smart" button

WSH Panel Mod

Reply #128
@Falstaff:
I think it's because PSS draws background after WSH Panel Mod refresh its background in "Pseudo transparent" mode.
You can try the following, to make sure WSH Panel Mod refresh its background after PSS have drawn background (It's not due to the optimization of WM_PAINT message) :

...
// draw background here...
$imageabs()...
$drawimage()...
...
// at last, use $movepanel_c()
$movepanel_c(WSH,...)


it's already what i do (just checked by adding this WSH panel in the main PSS), so it's really a WSH issue.



$movepanel_c(WSH,x,y,w,h) is the last command into my PSS panel, but on track change, the bg of the WSH keeps the previous bg, not the new one

so, any idea ? on_paint() not in cause ??

WSH Panel Mod

Reply #129
Well, seems that $movepanel_c() won't refresh the window anymore if window size doesn't change.
I'll look into it, and this will make me add ugly hacks...

WSH Panel Mod

Reply #130
Well, seems that $movepanel_c() won't refresh the window anymore if window size doesn't change.
I'll look into it, and this will make me add ugly hacks...


thank you very much,

...but why an "ugly hack" ? i find that it is WSH panel that needs to refresh its background on track change, isn't it ??? if not, transparency has a lack. Btw, all other panels refresh their bg on track change (no resize of these panels needed!).

thanx again for fixing this issue which is top problem for me

keep up the good work!

WSH Panel Mod

Reply #131
Yep, I noted what in Windows 7 this problem is absent.
So in WinXP this feature can't be avoided? Sad, but that's the way the cookie crumbles  Will made volumebar opacue


WSH Panel Mod

Reply #133
1.1.8 Beta uploaded.

WSH Panel Mod

Reply #134
thank you very much, you have fixed the bg refresh problem (btw on windows Seven!)

i still test but it looks good now

 

WSH Panel Mod

Reply #135
My transparency problems at start-up or track-change are gone now, thanks a lot!

but there´s a new problem. I posted the following in both threads (here and at PSS), cause I´m not shure which one causes this or maybe it´s a problem of crosstalk of both:

I use a PSS button to switch playlist on and off.

Then the position of a WSH panel is changed depending on visibility of playlist panel:

$if($isvisible_c(Playlist),
    $movepanel_c(Rating,$sub($div(%_width%,2),57),$sub(%_height%,213),115,15),
    $movepanel_c(Rating,$sub($div(%_width%,2),57),$sub(%_height%,114),115,15)
)

what happens is, the WSH panel is shown twice UNTIL I leave the switch button. When I leave the button the 'old' position vanishes.

I think (as I mentioned before) that refresh commands are not completely executed after first click...

WSH Panel Mod

Reply #136
My transparency problems at start-up or track-change are gone now, thanks a lot!

but there´s a new problem. I posted the following in both threads (here and at PSS), cause I´m not shure which one causes this or maybe it´s a problem of crosstalk of both:

I use a PSS button to switch playlist on and off.

Then the position of a WSH panel is changed depending on visibility of playlist panel:

$if($isvisible_c(Playlist),
    $movepanel_c(Rating,$sub($div(%_width%,2),57),$sub(%_height%,213),115,15),
    $movepanel_c(Rating,$sub($div(%_width%,2),57),$sub(%_height%,114),115,15)
)

what happens is, the WSH panel is shown twice UNTIL I leave the switch button. When I leave the button the 'old' position vanishes.

I think (as I mentioned before) that refresh commands are not completely executed after first click...


it's a PSS issue, not a WSH one


WSH Panel Mod

Reply #138
Please help with progress bar. When pause the playback, exit and restart boobar, it doesn't redraw the paused position. It also doesn't shows "playback stopped" when started in stopped state.  Here is the code:

Code: [Select]
// Flags, used with GdiDrawText
// For more information, see: [url=http://msdn.microsoft.com/en-us/library/dd162498(VS.85).aspx]http://msdn.microsoft.com/en-us/library/dd162498(VS.85).aspx[/url]
var DT_TOP = 0x00000000;
var DT_LEFT = 0x00000000;
var DT_CENTER = 0x00000001;
var DT_RIGHT = 0x00000002;
var DT_VCENTER = 0x00000004;
var DT_BOTTOM = 0x00000008;
var DT_WORDBREAK = 0x00000010;
var DT_SINGLELINE = 0x00000020;
var DT_EXPANDTABS = 0x00000040;
var DT_TABSTOP = 0x00000080;
var DT_NOCLIP = 0x00000100;
var DT_EXTERNALLEADING = 0x00000200;
var DT_CALCRECT = 0x00000400;
var DT_NOPREFIX = 0x00000800;
var DT_INTERNAL = 0x00001000;
var DT_EDITCONTROL = 0x00002000;
var DT_PATH_ELLIPSIS = 0x00004000;
var DT_END_ELLIPSIS = 0x00008000;
var DT_MODIFYSTRING = 0x00010000;
var DT_RTLREADING = 0x00020000;
var DT_WORD_ELLIPSIS = 0x00040000;
var DT_NOFULLWIDTHCHARBREAK = 0x00080000;
var DT_HIDEPREFIX = 0x00100000;
var DT_PREFIXONLY = 0x00200000;

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

var g_font = gdi.Font("LCD", 18, 1);
var g_drag = 0;
var g_drag_seek = 0;
var tfo = fb.TitleFormat("POS: %playback_time%/%length% '('$max(0,$left($muldiv(%playback_time_seconds%,1000,%length_seconds%),$sub($len($muldiv(%playback_time_seconds%,1000,%length_seconds%)),1)))'.'$right($muldiv(%playback_time_seconds%,1000,%length_seconds%),1)'%)' REM: %playback_time_remaining%");
var txt = "";

function TimeFmt(t){
var zpad = function(n){
var str = n.toString();
return (str.length<2) ? "0"+str : str;
}
var h = Math.floor(t/3600); t-=h*3600;
var m = Math.floor(t/60); t-=m*60;
var s = Math.floor(t);
if(h>0) return h.toString()+":"+zpad(m)+":"+zpad(s);
return m.toString()+":"+zpad(s);
}

function on_paint(gr){
var pos =0;

if(fb.PlaybackLength > 0){
if(g_drag){
pos = window.Width * g_drag_seek;
txt = "Seek " + TimeFmt(g_drag_seek * fb.PlaybackLength) + " / " + TimeFmt(fb.PlaybackLength);
}
else{
pos = window.Width * (fb.PlaybackTime / fb.PlaybackLength);
txt = tfo.Eval();
}

}


gr.FillGradRect(  0, 0, pos, window.Height, 90, RGB(240,240,240), RGB(46,48,63));
gr.FillGradRect(pos, 0, window.Width-pos, window.Height, 90, RGB(240,240,240), RGB(190,190,190));
gr.GdiDrawText(txt, g_font, RGB(50,50,50), 0, 0, window.Width, window.Height, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
gr.DrawRect(0,0, window.Width-1, window.Height-1, 1.0, RGB(150,150,150));
}

function on_mouse_lbtn_down(x,y){
g_drag = 1;
}

function on_mouse_lbtn_up(x,y){
if(g_drag){
g_drag = 0;
g_drag_seek = x / window.Width;
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
fb.PlaybackTime = fb.PlaybackLength * g_drag_seek;
}
}

function on_mouse_move(x,y){
if(g_drag){
g_drag_seek = x / window.Width;
g_drag_seek = (g_drag_seek<0) ? 0 : (g_drag_seek<1) ? g_drag_seek : 1;
window.Repaint();
}
}

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

function on_playback_stop(){
txt = "Playback Stopped";
window.Repaint();
}

function on_playback_starting(cmd, paused){
}
function on_playback_new_track(info){
window.Repaint();
}
//EOF

WSH Panel Mod

Reply #139
@acmodeu:
on_paint() will be executed on startup, so set "txt" variable there.

Code: [Select]
// Flags, used with GdiDrawText
// For more information, see: [url=http://msdn.microsoft.com/en-us/library/dd162498(VS.85).aspx]http://msdn.microsoft.com/en-us/library/dd162498(VS.85).aspx[/url]
var DT_CENTER = 0x00000001;
var DT_VCENTER = 0x00000004;
var DT_SINGLELINE = 0x00000020;

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

var g_font = gdi.Font("LCD", 18, 1);
var g_drag = 0;
var g_drag_seek = 0;
var tfo = fb.TitleFormat("POS: %playback_time%/%length% '('$max(0,$left($muldiv(%playback_time_seconds%,1000,%length_seconds%),$sub($len($muldiv(%playback_time_seconds%,1000,%length_seconds%)),1)))'.'$right($muldiv(%playback_time_seconds%,1000,%length_seconds%),1)'%)' REM: %playback_time_remaining%");

function TimeFmt(t) {
var zpad = function(n) {
var str = n.toString();
return (str.length < 2) ? "0" + str: str;
}
var h = Math.floor(t / 3600);
t -= h * 3600;
var m = Math.floor(t / 60);
t -= m * 60;
var s = Math.floor(t);
if (h > 0) return h.toString() + ":" + zpad(m) + ":" + zpad(s);
return m.toString() + ":" + zpad(s);
}

function on_paint(gr) {
var txt = "";
var pos = 0;

if (fb.IsPlaying && fb.PlaybackLength > 0) {
if (g_drag) {
pos = window.Width * g_drag_seek;
txt = "Seek " + TimeFmt(g_drag_seek * fb.PlaybackLength) + " / " + TimeFmt(fb.PlaybackLength);
}
else {
pos = window.Width * (fb.PlaybackTime / fb.PlaybackLength);
txt = tfo.Eval();
}
}
else {
txt = "Playback Stopped";
}

gr.FillGradRect(0, 0, pos, window.Height, 90, RGB(240, 240, 240), RGB(46, 48, 63));
gr.FillGradRect(pos, 0, window.Width - pos, window.Height, 90, RGB(240, 240, 240), RGB(190, 190, 190));
gr.GdiDrawText(txt, g_font, RGB(50, 50, 50), 0, 0, window.Width, window.Height, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
gr.DrawRect(0, 0, window.Width - 1, window.Height - 1, 1.0, RGB(150, 150, 150));
}

function on_mouse_lbtn_down(x, y) {
g_drag = 1;
}

function on_mouse_lbtn_up(x, y) {
if (g_drag) {
g_drag = 0;
g_drag_seek = x / window.Width;
g_drag_seek = (g_drag_seek < 0) ? 0 : (g_drag_seek < 1) ? g_drag_seek: 1;
fb.PlaybackTime = fb.PlaybackLength * g_drag_seek;
window.Repaint();
}
}

function on_mouse_move(x, y) {
if (g_drag) {
g_drag_seek = x / window.Width;
g_drag_seek = (g_drag_seek < 0) ? 0 : (g_drag_seek < 1) ? g_drag_seek: 1;
window.Repaint();
}
}

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

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

function on_playback_new_track(info) {
window.Repaint();
}
//EOF

WSH Panel Mod

Reply #140
@T.P Wang:
Now it shows "Playback stopped" even if it was paused. Could you give a hint how to work this out?

WSH Panel Mod

Reply #141
Oh, it's just a foobar 0.9.6.6 bug.

WSH Panel Mod

Reply #142
What's this foobar2000 v0.9.6.6 bug, precisely? Are you sure it's foobar2000's fault?

WSH Panel Mod

Reply #143
What's this foobar2000 v0.9.6.6 bug, precisely? Are you sure it's foobar2000's fault?

Foobar doesn't load paused track until you resume it. This doesn't happen on 0.9.6.3 at least. May be on even later version.



WSH Panel Mod

Reply #146
Hi,
Two years ago, I took a Intro to JAVA course at my school. I remember that the Instructor told us to us System.Out.Println(string); to print things to he console.

I was wondering If there is anything similar to this in JScript. That is, printing variables to the console in Foobar.

WSH Panel Mod

Reply #147
In WSH Panel mod:
fb.Trace(string)

WSH Panel Mod

Reply #148
I have been puzzling today with WSH panel mod to convert the icon bar I made in panel stack splitter and it works fine now, except for one thing: I have 3 different layouts which I use in 3 different windowsizes, which I set with WINDOWSIZE from a panel stack splitter button. Can I do this aswel from WSH panel mod?

WSH Panel Mod

Reply #149
question :

is there a  way to execute external program in Jscript or Vbs from WSH ?

something lik this :

var WshShell = new ActiveXObjec("WScript.Shell");
WshShell.exec("c:/windows/notepad.exe");

my idea is not to do a button to launch the notepad, no, but my webbrowser if i set an address  would be great !! foo_run no more needed

var WshShell = new ActiveXObjec("WScript.Shell");
WshShell.exec(http://en.wikipedia.org/wiki/$replace(%artist%,' ','_'));

any idea of what king of onject is needed, and just if it's possible... ?

thanx