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

WSH Panel Mod

Reply #1050
Thanks, work fine now.


WSH Panel Mod

Reply #1052
I tried to use the ReadTextFile method but I got "Invalid procedure call or argument". I simply used it like this "blacklist = utils.ReadTextFile(blacklist_file)" with blacklist_file is a the fullpath to a file. What's wrong?


you haven't set the codepage in arguments!

try
utils.ReadTextFile(blacklist_file,<valid_codepage>)

you can consider using helper routines for codepage in Codepages.txt

lyrik 1.4
[link]

where is your lyrik 1.4 download address?

I can't download now

please give me another download address

WSH Panel Mod

Reply #1053
@hejiamei: Falstaff was referring to new version 1.4.0 of WSH panel component, and not his WSH lyrics code. Although accidentally 1.4 is also expected version of next Falstaff lyrics script, he is talking about new features of the WSH component
BTW you are posting in discussion related to WSH component. Scripts are discussed in that other thread where you already posted and I'm sure Falstaff will reply to you ASAP

WSH Panel Mod

Reply #1054
Help: maybe a bug ?

i'm playing with fb.GetSelections(), and i see that the behaviour is weird for some use, i explain :

1) if i select all the tracks of my playlist (20 items) with CTRL+A, all track are selected in the playlist (i use ELPlaylist), then if i use: var glist=fb.GetSelections(); then glist.Count return the value requested => 20
==> it's what that i expected

2) if i code the Select all in my WSH panel: fb.RunMainMenuCommand("Select all"); then if i use: var glist=fb.GetSelections(); then glist.Count return the value 1, and not 20 as expected !

any idea? is this a WSH panel mod issue?

thanx by advance for any help, enlightment ...

WSH Panel Mod

Reply #1055
Did you mean fb.RunMainMenuCommand("Edit/Select all");?
It seems like some (or all) Edit menu commands don't work within WSH code since a long time ago. I had also tried to get all playlist tracks but couldn't. Sort commands from Edit don't work too. I think this is Foobar2000 feature so it would be great if T.P Wang add a special command to get playlist MetaDB Handles List.

UPD.:
Oh, it works with this code:
Code: [Select]
function on_mouse_lbtn_up(x, y, mask) {
    fb.RunMainMenuCommand("Edit/Select all");
}

But only on double click. Very strange.

WSH Panel Mod

Reply #1056
fb.RunMainMenuCommand("Select all"); works fine for me, it do the job (select all the tracks in the active playlist), but the thing that doesn't work is fb.GetSelections after this selection way ...

WSH Panel Mod

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

WSH Panel Mod

Reply #1058
Can someone show me an example how to create a autoplaylist and view that autoplaylist.
I've fiddled with the CreateAutoPlaylist(idx, name, query, sort = "", flags = 0); code.
But I don't get it yet. A working (simple) example would be nice.
<3 f00

WSH Panel Mod

Reply #1059
Can someone show me an example how to create a autoplaylist and view that autoplaylist.
I've fiddled with the CreateAutoPlaylist(idx, name, query, sort = "", flags = 0); code.
But I don't get it yet. A working (simple) example would be nice.


I've fiddled some more, and I got it working now. 
<3 f00


WSH Panel Mod

Reply #1061
I've fiddled some more, and I got it working now. 


would be nice if you share the snippet.
thanks



I want to state that I'm a total newbie to WSH_panel_mod coding, so take this snippet as is.
It probably can be refined.

Code: [Select]
Buttons[0]=new Button(10,btn_y,200,75, {normal: images_BB + "empty.png", hover: images_BB + "Start_wide.png"}, function(){fb.RemovePlaylist(99);fb.CreateAutoPlaylist(99,'LENNON', "ARTIST HAS LENNON", sort ="%tracknumber%", flags = 1);fb.RunMainMenuCommand('View/Switch to playlist/LENNON')}, "LENNON");


Is there a way to reload a script when a certain action is made?
I want to rerun a script when there is a playlist switch.
<3 f00

WSH Panel Mod

Reply #1062
Help: maybe a bug ?

i'm playing with fb.GetSelections(), and i see that the behaviour is weird for some use, i explain :

1) if i select all the tracks of my playlist (20 items) with CTRL+A, all track are selected in the playlist (i use ELPlaylist), then if i use: var glist=fb.GetSelections(); then glist.Count return the value requested => 20
==> it's what that i expected

2) if i code the Select all in my WSH panel: fb.RunMainMenuCommand("Select all"); then if i use: var glist=fb.GetSelections(); then glist.Count return the value 1, and not 20 as expected !

any idea? is this a WSH panel mod issue?

thanx by advance for any help, enlightment ...


function on_selection_changed(metadb) {

    fb.RunMainMenuCommand("Select all");
    var glist=fb.GetSelections();
    fb.trace(glist.Count)

}

WSH Panel Mod

Reply #1063
thanx asionwu, it works effectively when it's called from on_selection_changed(),

but the behaviour is weird, do not work in some callbacks

WSH Panel Mod

Reply #1064
Why is it that GdiDrawText(str, IGdiFont, color, x, y, w, h, format = 0) draws text that looks make sharper and better than DrawString(str, IGdiFont, color, x, y, w, h, flags = 0) with the same clear type text rendering hint. T.P Wang can you do something about this?

WSH Panel Mod

Reply #1065
Question:

Can I use window.NotifyOthers(name, info) & function on_notify_data(name, info) {} to pass a variable from WSH_panel A to WSH_panel B?
If so, are there any examples somewhere to be find?
<3 f00

WSH Panel Mod

Reply #1066
Yes you can.

For example use in panel A:
Code: [Select]
var my_variable = 10;

window.NotifyOthers("my_variable_notify", my_variable);


And in panel B:
Code: [Select]
var my_variable;

function on_notify_data(name, info) {
     if(name=="my_variable_notify") my_variable = info;
}

 

WSH Panel Mod

Reply #1067
Yes you can.

For example use in panel A:
Code: [Select]
var my_variable = 10;

window.NotifyOthers("my_variable_notify", my_variable);


And in panel B:
Code: [Select]
var my_variable;

function on_notify_data(name, info) {
     if(name=="my_variable_notify") my_variable = info;
}


Thank you,
I'm gonna try to get this to work. 

cheers r3v0
<3 f00

WSH Panel Mod

Reply #1068
Yes you can.

For example use in panel A:
Code: [Select]
var my_variable = 10;

window.NotifyOthers("my_variable_notify", my_variable);


And in panel B:
Code: [Select]
var my_variable;

function on_notify_data(name, info) {
     if(name=="my_variable_notify") my_variable = info;
}


Thank you,
I'm gonna try to get this to work. 

cheers r3v0


please share your work,thx

WSH Panel Mod

Reply #1069
Yes you can.

For example use in panel A:
Code: [Select]
var my_variable = 10;

window.NotifyOthers("my_variable_notify", my_variable);


And in panel B:
Code: [Select]
var my_variable;

function on_notify_data(name, info) {
     if(name=="my_variable_notify") my_variable = info;
}


Zin-Uru,

I've setup the first part in panel A,
and the second part in panel B (with the { and } on the right place, as you forgot them in the above code).
In panel B I also have put a gr.DrawString to show the variable, but it doesn't show anything.
What am I overlooking?
<3 f00

WSH Panel Mod

Reply #1070
You should learn the basic of javascript various control first. In the case of the example if the if block only execute one line of code you won't need { }. As for your problem particularly, you need to refresh the panel to show the variable so
Code: [Select]
function on_notify_data(name, info) {
     if(name=="my_variable_notify") {
       my_variable = info;
       window.Repaint();
     }
}

WSH Panel Mod

Reply #1071
Why is it that GdiDrawText(str, IGdiFont, color, x, y, w, h, format = 0) draws text that looks make sharper and better than DrawString(str, IGdiFont, color, x, y, w, h, flags = 0) with the same clear type text rendering hint. T.P Wang can you do something about this?


Because GdiDrawText renders the text in default style of Windows, unable to be controlled by gr.SetTextRenderingHint; vice verse, DrawString would be controlled. Actually, Win7 and vista have totally different final effects with the same setting.

hope it helps you.
mad messy misanthropist morbid mused

WSH Panel Mod

Reply #1072
You should learn the basic of javascript various control first. In the case of the example if the if block only execute one line of code you won't need { }. As for your problem particularly, you need to refresh the panel to show the variable so
Code: [Select]
function on_notify_data(name, info) {
     if(name=="my_variable_notify") {
       my_variable = info;
       window.Repaint();
     }
}


You are absolutely right a should learn javascript better.
I'm learning it each day a little better by trial and error.
You know a good javascript reference book/website?

By the way you were right about the window.Repaint(); It works
Thanks!

<3 f00

WSH Panel Mod

Reply #1073
Because GdiDrawText renders the text in default style of Windows, unable to be controlled by gr.SetTextRenderingHint; vice verse, DrawString would be controlled. Actually, Win7 and vista have totally different final effects with the same setting.

hope it helps you.

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.

@r3v0: Try this site http://www.w3schools.com/JS/ . IMO, if you already knows Java or C/C++, learning JS is a matter of minutes. If not it would take longer as you would need to learn the basic of computer programming first.

WSH Panel Mod

Reply #1074
You should learn the basic of javascript various control first. In the case of the example if the if block only execute one line of code you won't need { }. As for your problem particularly, you need to refresh the panel to show the variable so
Code: [Select]
function on_notify_data(name, info) {
     if(name=="my_variable_notify") {
       my_variable = info;
       window.Repaint();
     }
}


You are absolutely right a should learn javascript better.
I'm learning it each day a little better by trial and error.
You know a good javascript reference book/website?

By the way you were right about the window.Repaint(); It works
Thanks!



MSDN's library could help you build the basic points of JScript.
mad messy misanthropist morbid mused