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

WSH Panel Mod

Reply #1075
MSDN's library could help you build the basic points of JScript.


Thanks for pointing that one out.

I'm now wondering why this doesn't work:

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_path%foo\WSH_scripts\common.js"
// ==/PREPROCESSOR==
ww = window.Width;
wh = window.Height;

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

// INITIALIZATION
var my_variable;
function on_notify_data(name, info) {
     if(name=="my_variable_notify") {
       my_variable = info;
       }
       window.Repaint();
}

var ChartType = 'Top2000';
var ChartType_img = gdi.Image(fb.FoobarPath + "foo\\f003\\BB\\"+ ChartType + ".png");
var Years_img = gdi.Image(fb.FoobarPath + "foo\\f003\\BB\\"+ my_variable + ".png");


function on_paint(gr) {

gr.DrawImage(ChartType_img,0,0,200,75, 0, 0, 200,75);
gr.DrawImage(Years_img, 0,0,200,75, 0, 0, 200,75);

}


The console gives this error:
Invalid procedure call or argument
Ln: 27, Col: 1

<3 f00

WSH Panel Mod

Reply #1076
MSDN's library could help you build the basic points of JScript.


Thanks for pointing that one out.

I'm now wondering why this doesn't work:

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_path%foo\WSH_scripts\common.js"
// ==/PREPROCESSOR==
ww = window.Width;
wh = window.Height;

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

// INITIALIZATION
var my_variable;
function on_notify_data(name, info) {
     if(name=="my_variable_notify") {
       my_variable = info;
       }
       window.Repaint();
}

var ChartType = 'Top2000';
var ChartType_img = gdi.Image(fb.FoobarPath + "foo\\f003\\BB\\"+ ChartType + ".png");
var Years_img = gdi.Image(fb.FoobarPath + "foo\\f003\\BB\\"+ my_variable + ".png");


function on_paint(gr) {

gr.DrawImage(ChartType_img,0,0,200,75, 0, 0, 200,75);
gr.DrawImage(Years_img, 0,0,200,75, 0, 0, 200,75);

}


The console gives this error:
Invalid procedure call or argument
Ln: 27, Col: 1


when WSH is in on_paint, the Years_img is gdi.Image(fb.FoobarPath + "foo\\f003\\BB\\.png"), this is not exist an illegal in program.
you should replace the gr.DrawImage(Years_img, 0,0,200,75, 0, 0, 200,75); to gr.DrawImage(gdi.Image(fb.FoobarPath + "foo\\f003\\BB\\"+ my_variable + ".png"), 0,0,200,75, 0, 0, 200,75);

because the code out of callback functions would only be executed once on program start, and when you refresh window, the Years_img did not change at all.
mad messy misanthropist morbid mused

WSH Panel Mod

Reply #1077
when WSH is in on_paint, the Years_img is gdi.Image(fb.FoobarPath + "foo\\f003\\BB\\.png"), this is not exist an illegal in program.
you should replace the gr.DrawImage(Years_img, 0,0,200,75, 0, 0, 200,75); to gr.DrawImage(gdi.Image(fb.FoobarPath + "foo\\f003\\BB\\"+ my_variable + ".png"), 0,0,200,75, 0, 0, 200,75);

because the code out of callback functions would only be executed once on program start, and when you refresh window, the Years_img did not change at all.


I have replaced that line, but I still get the same error.
<3 f00

WSH Panel Mod

Reply #1078
This has to work:
Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_path%foo\WSH_scripts\common.js"
// ==/PREPROCESSOR==
ww = window.Width;
wh = window.Height;

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

// INITIALIZATION
var my_variable = null;
function on_notify_data(name, info) {
     if(name=="my_variable_notify") {
       my_variable = info;
       }
       window.Repaint();
}

var ChartType = 'Top2000';
var ChartType_img = gdi.Image(fb.FoobarPath + "foo\\f003\\BB\\"+ ChartType + ".png");
var Years_img = null;

function on_paint(gr) {

gr.DrawImage(ChartType_img,0,0,200,75, 0, 0, 200,75);

if(Years_img!=null) {
    gr.DrawImage(Years_img, 0,0,200,75, 0, 0, 200,75);
} else if(my_variable!=null) {
    Years_img = gdi.Image(fb.FoobarPath + "foo\\f003\\BB\\"+ my_variable + ".png");
}

}




WSH Panel Mod

Reply #1082
Question/Request: Could WSH panel Mod provide an easy way to transform an autoplaylist in a normal playlist ?


reminder for an answer please


And to change an autoplaylist query!


changing the query can be already done by overwriting (delete the auto playlist and create a new one with the new query then move it at the same place) or by using the query edit window.

but the lack is to retrieve the query of an existing autoplaylist in a string ...

WSH Panel Mod

Reply #1083
Question/Request: Could WSH panel Mod provide an easy way to transform an autoplaylist in a normal playlist ?

I'll consider that.

Bug reports:
. utils.Glob() function file handle leak. Every time I use this function, it leak another handle, please check.

Confirmed, will be fixed in the next version, thanks for reporting.


Nah, both DrawText and DrawString adhere to gr.SetTextRenderingHint various settings, but DrawText always looks better under any text rendering hint. The sole reason I can't use DrawText exclusively is because MeasureString is a GDI+ function and won't work correctly with DrawText, if only DrawTextEx was implemented so I can use DT_CALCRECT to get the size of GDI text rectangle.

1. SetTextRenderingHint() won't affect DrawText since it uses GDI.
2. You can use DT_CALCRECT, see example from Scroll with GdiDrawText.txt
And, FYI: Why text appears different when drawn with GDIPlus versus GDI (http://support.microsoft.com/kb/307208)

but the lack is to retrieve the query of an existing autoplaylist in a string ...

The query string is held internally by autoplaylist client so is not possible to retrieve outside.


WSH Panel Mod

Reply #1085
@T.P Wang or @someone who knows a solution ...

question about a weird behaviour (for me...) :

on_playlists_changed() callback is not called when i add a track to a non-active playlist, is not normal ??? it's a problem, because i can't catch any change on a playlist and so i can't refresh the display of my wsh playlist manager (playlist item count display for example) ==> example: When i send a track from the active playlist to another playlist (non active), no event available to detect that

any idea ?

thanx by advance

WSH Panel Mod

Reply #1086
@Falstaff:
on_playlists_changed() doens't track the changes of items of playlists, only playlists themselves.
These events you needed don't exist  for now. I may include them in the next version.


 

WSH Panel Mod

Reply #1088
I'm trying with no success to rework some of the existing scripts to make %artist% - %title% move from right to left during playback in one of my wsh panels. Is there a sample code for smooth scrolling not based on the playback time because I'd like the speed to be more adjustable.
Thanks.

WSH Panel Mod

Reply #1089
I'm trying with no success to rework some of the existing scripts to make %artist% - %title% move from right to left during playback in one of my wsh panels. Is there a sample code for smooth scrolling not based on the playback time because I'd like the speed to be more adjustable.
Thanks.

Look here my post

WSH Panel Mod

Reply #1090
@T.P Wang:

Problem report:
I'm having trouble with callback on_playback_stop(reason). It seems like on shutting_down (reason == 3) it does not get fired, please check.

Another thing, in case you manage to fix the aforementioned problem, can you also make sure that on_playback_stop(reason == 3) is always fired before callback on_script_unload(). I need to save some data on shutting down and these functions working correctly is essential.

Thanks.

WSH Panel Mod

Reply #1091
@thuan:
Use on_script_unload() instead. Panels are always closed before shutting down, so you can't get that callback...

WSH Panel Mod

Reply #1092
Thanks, T.P. Wang, I managed to do it but as I can't use the logic I said in my previous post I need to add in some more flags for additional check in on_script_unload(). Anyway it works now, thanks again.

WSH Panel Mod

Reply #1093
@T.P Wang:

Me again, is there a way to know if a metadb is inside user library or not without resorting to titleformatting which depends on foo_playcount? If there is not, may I request this feature as an property of IFbMetadbHandle interface.

Thanks.

WSH Panel Mod

Reply #1094
@T.P Wang:

Me again, is there a way to know if a metadb is inside user library or not without resorting to titleformatting which depends on foo_playcount? If there is not, may I request this feature as an property of IFbMetadbHandle interface.

Thanks.

fb.IsMetadbInMediaLibrary(metadb)

Is it?
mad messy misanthropist morbid mused

WSH Panel Mod

Reply #1095
I don't know how I could miss that, I skimmed the document up and down a few times. Thank you.

WSH Panel Mod

Reply #1096
WSH Panel Mod v1.4.1 Beta 1 Released:
changelog:
Code: [Select]
- ADD: New feature for drag and drop: @feature "dragdrop".
- ADD: New callbacks for drag and drop: on_drag_enter(), on_drag_over(), on_drag_leave() and on_drag_drop().
- ADD: New callbacks for playlist: on_playlist_items_added() and on_playlist_items_removed().
- FIX: Fix memory leaks in utils.Glob().


Note that drag drop support is limited and may be changed in the future during the beta stages.

WSH Panel Mod

Reply #1097
Thanks for the fix, I'll test it later. I also have a question regarding feature preprocessor. Say, what is the advantage of setting // @feature "v1.4" in preprocessor section? I don't use the disabled functions but if all it does is disabling these functions and methods, I don't see the point in setting it.

WSH Panel Mod

Reply #1098
WSH Panel Mod v1.4.1 Beta 1 Released:
changelog:
Code: [Select]
- ADD: New feature for drag and drop: @feature "dragdrop".
- ADD: New callbacks for drag and drop: on_drag_enter(), on_drag_over(), on_drag_leave() and on_drag_drop().
- ADD: New callbacks for playlist: on_playlist_items_added() and on_playlist_items_removed().
- FIX: Fix memory leaks in utils.Glob().


Note that drag drop support is limited and may be changed in the future during the beta stages.


Amazing, now i will be able to drag'n'drop track from a playlist to another by draging these tracks from the playlist (ELPlaylist in my case) to my WSH playlist manager !!! ^^

i've made a quick test, it works !!! Thanx a lot T.P

One question, in the drag and drop callbacks, what is the 1st argument have to be exactly ??? void ?



WSH Panel Mod

Reply #1099
Thanks for the fix, I'll test it later. I also have a question regarding feature preprocessor. Say, what is the advantage of setting // @feature "v1.4" in preprocessor section? I don't use the disabled functions but if all it does is disabling these functions and methods, I don't see the point in setting it.
Code: [Select]
// NOTE: metadb will be [b][color=#0000FF]metadb handle list[/color][/b] (already sorted) when preprocessor directive "feature":
//  1. "v1.4" and later is set;
//  2. "watch-metadb" is set.
function on_metadb_changed(metadb, fromhook) {}
So for now, it's always combined with feature "watch-metadb", and prevent collisions.
And I know they are bad documented 

One question, in the drag and drop callbacks, what is the 1st argument have to be exactly ??? void ?
They are reserved for future use, so they are meaningless now.
And I've upload a new sample here:
http://foo-wsh-panel-mod.googlecode.com/hg...rop%20Basic.txt