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

WSH Panel Mod script discussion/help

Reply #650
samples updated:

http://cid-649d3bfeaf541fbb.office.live.co...ide/samples.zip

i've updated the "simple biograhy" script to use the new redirection feature made available in the last.fm API. this helps if your files are incorrect tagged.

old version of script with wrong tags / new script with spelling correction off


new version of script, wrong tags, spelling correction on:


note this does not touch your file tagging at all. it's simply for display purposes.


This doesnt appear to work for me. I have spelling correction turned off and whilst the biography details are of those it has redirected to, it doesnt display the "redirected from" text. Has this been removed from the latest samples script?

Example: Swedish House Mafia feat. Pharrell - One (Your Name)

The biography panel displays the info from the Swedish House Mafia page which when viewing in my browser states I have been redirected from Swedish House Mafia feat. Pharrell page. The artist name in bold in the heading remains as Swedish House Mafia feat. Pharrell. As the thumbnails 2 panel displays the images from the Swedish House Mafia feat. Pharrell page.

WSH Panel Mod script discussion/help

Reply #651
I'm using tooltip_buttons.js found in 1 of the 2 WSH threads.
How can I get the coordinates-part into the on_paint{} part?

I want this for instance:

Code: [Select]
function on_paint(gr) {

var Buttons = new Array;
Buttons[0]=new Button( 10, 80, 200, 75, {normal: images_BB + "Start_wide.png", hover: images_BB + "Start_wide.png"}, function(){blablabla}, "blablabla");
Buttons[1]=new Button( 10, 160, 200, 75, {normal: images_BB + "Start_wide.png", hover: images_BB + "Start_wide.png"}, function(){blablabla}, "blablabla");

var ChartType = 'Top2000';

var ChartType_img = gdi.Image(fb.FoobarPath + "foo\\f003\\BB\\"+ ChartType + ".png");
        Buttons[0].draw(gr);
        Buttons[1].draw(gr);

}


But this doesn't seem to work.
Can anyone give me a hint?
<3 f00

WSH Panel Mod script discussion/help

Reply #652
Hi All,

Apologies for involve everyone, I really appreciated can get someone‘s help.

I have used Tedgo’s version - DarkoneV3.01 for foobar2k, my question is How to simulate keyboard events through WSH script? There is no work for me after try to recode the Additional Buttons Panel script several times, I also search solution through internet,but...

I have make the two button point to the function(see below Additional Buttons Panel code)

Buttons.a = new Button(0, 22, 60, 14, {normal: imgPath + "AddOnAlone.png", hover: imgPath + "AddOnAloneMH.png"}, function(){fb.ShowConsole();});
Buttons.b = new Button(83, 22, 58, 14, {normal: imgPath + "AddOnLeft.png", hover: imgPath + "AddOnLeftMH.png"}, function(){fb.ShowPreferences();});
Buttons.c = new Button(141, 22, 57, 14, {normal: imgPath + "AddOnRight.png", hover: imgPath + "AddOnRightMH.png"}, function(){fb.RunMainMenuCommand("Equalizer");});

Change:
fb.RunMainMenuCommand("Show Status pane") to fb.ShowPreferences()

fb.RunMainMenuCommand("Show Status bar") to fb.RunMainMenuCommand("Equalizer")

I just want them more useful to me,there is a Third-party plugins ---Autolyric(http://www.autolyric.com/index_en.htm),it can make Lyrics display on the desktop, it's very cool, I have set global shortcut keys(Alt+W) to show desktop Lyrics because I only can set it in Autolyric Preferences not foobar Preferences.

So whether button mouse click simulate the keyboard events,how to recode JS or anyway solution for that? Maybe I need to modify the WSH mod inferface, jscript, DO Global Script.js, DO Global Button Script.js, I have test and try but have no idea.

Could anyone please help me,I just want to make Darkone more and more easy-to-use.

Thanks for all, my friends.

Mejor

Tedgo has replied to me, see below, but I hope can get more help, who have better idea? or how to use the function on_key_down(vkey){}...

~tedgo 18 hours ago has replied

Its not possible to handle third-party-components within WSH Panel mod (at least to my knowledge...).

Maybe its possible when using foo_run (optional component) to execute commands via command-line, if Autolyric is able to used via commandline.
Then you could create a button in WSH Panel mod (fb.RunContextCommand("Run services/Name of your action").

I must confess that i never used keyboard shortcuts via WSH Panel mod, so maybe you should ask in the WSH Panel mod thread on hydrogenaudio. There may be a solution i don't know (or never thought about, since WSH Panel mod offers the - from me - never used possibility to disable "Safe mode" and will then have an enhanced functionality, but is probably insecure...).

There are some callbacks, though:
function on_key_down(vkey){} and function on_key_up(vkey){}
And here are the "vkeys" to be used: [link]
So you could "persuade" WSH Panel mod to use shortcuts to run foo_run.

Its the only thing i can imagine of for the moment...

WSH Panel Mod script discussion/help

Reply #653
Is it possible to change the colour of text contained in brackets, similar to how it can be done with columns ui.

$replace(%title%,']',$rgb(0,0,0),'[',$rgb(255,0,0))

The $rgb function does not work with WSH Panel Mod.


WSH Panel Mod script discussion/help

Reply #654
Is it possible to change the colour of text contained in brackets, similar to how it can be done with columns ui.

$replace(%title%,']',$rgb(0,0,0),'[',$rgb(255,0,0))

The $rgb function does not work with WSH Panel Mod.

WSH panel mod could only translate the TF that produces strings.
If you want to change the color of a character appearing on screen, you can only use DrawString or GdiDrawText by assigning a color parameter to either of them.
mad messy misanthropist morbid mused

WSH Panel Mod script discussion/help

Reply #655
When is callback on_script_unload() get called? Is it only when foobar starts?


WSH Panel Mod script discussion/help

Reply #657
When is callback on_script_unload() get called? Is it only when foobar starts?

when will the script unload?
certainly at the end of this program.
mad messy misanthropist morbid mused

 

WSH Panel Mod script discussion/help

Reply #658
Is there a way to declare a var only at the start of loading the panel?
If tried to use window.onload, but this gives me an error.
<3 f00

WSH Panel Mod script discussion/help

Reply #659
Is there a way to declare a var only at the start of loading the panel?
If tried to use window.onload, but this gives me an error.

If you DONOT change the value assigned to a variable declared at the beginning of the panel's script, the variable is unchanged.

Actually, under current non-fast mode, all the variable do not need declaring when used.

EineVariable = 2;
is equal to
var EineVariable = 2;
mad messy misanthropist morbid mused

WSH Panel Mod script discussion/help

Reply #660
Is there a way to declare a var only at the start of loading the panel?
If tried to use window.onload, but this gives me an error.

If you DONOT change the value assigned to a variable declared at the beginning of the panel's script, the variable is unchanged.

Actually, under current non-fast mode, all the variable do not need declaring when used.

EineVariable = 2;
is equal to
var EineVariable = 2;


Maybe I need to explain what I want to do.

At start I want to read a string from an ini file,
that string I want to use as an default value in a var.
When there is an event, for instance a mouse click, another value is assigned to that var.
<3 f00

WSH Panel Mod script discussion/help

Reply #661
Maybe I need to explain what I want to do.

At start I want to read a string from an ini file,
that string I want to use as an default value in a var.
When there is an event, for instance a mouse click, another value is assigned to that var.

What you want is so weird, 'cause it's exactly how a program assign its own variables.
.......

var EineVar = "Initialized";
function on_mouse_lbtn_down(x,y,mask){
fb.trace(EineVar);
EineVar  = "Changed";
fb.trace(EineVar);
}

/////////////////
//the console looks like:
//Initialized
//Changed

Is it?
BTW, window.GetProperty is much more useful and opreatable than ReadINI.
mad messy misanthropist morbid mused

WSH Panel Mod script discussion/help

Reply #662
Maybe I need to explain what I want to do.

At start I want to read a string from an ini file,
that string I want to use as an default value in a var.
When there is an event, for instance a mouse click, another value is assigned to that var.


What you want is so weird, 'cause it's exactly how a program assign its own variables.
.......

var EineVar = "Initialized";
function on_mouse_lbtn_down(x,y,mask){
fb.trace(EineVar);
EineVar  = "Changed";
fb.trace(EineVar);
}

/////////////////
//the console looks like:
//Initialized
//Changed

Is it?
BTW, window.GetProperty is much more useful and opreatable than ReadINI.


That's right.
But, I tried to use what you described dozens of times.
I use the var to determine if value a or b is used.
And that value I use to decide whether image a or image b is shown.
When instead of an image I use a text, It works.

The difference between the image and the text is,
that to show the image, I put the var in another var to declare the path to the image.
I can't lay my finger on the problem.

<3 f00

WSH Panel Mod script discussion/help

Reply #663
Maybe I need to explain what I want to do.

At start I want to read a string from an ini file,
that string I want to use as an default value in a var.
When there is an event, for instance a mouse click, another value is assigned to that var.


What you want is so weird, 'cause it's exactly how a program assign its own variables.
.......

var EineVar = "Initialized";
function on_mouse_lbtn_down(x,y,mask){
fb.trace(EineVar);
EineVar  = "Changed";
fb.trace(EineVar);
}

/////////////////
//the console looks like:
//Initialized
//Changed

Is it?
BTW, window.GetProperty is much more useful and opreatable than ReadINI.


That's right.
But, I tried to use what you described dozens of times.
I use the var to determine if value a or b is used.
And that value I use to decide whether image a or image b is shown.
When instead of an image I use a text, It works.

The difference between the image and the text is,
that to show the image, I put the var in another var to declare the path to the image.
I can't lay my finger on the problem.


just tell me how did you "put the var in another var".
mad messy misanthropist morbid mused


WSH Panel Mod script discussion/help

Reply #665
just tell me how did you "put the var in another var".

well, I put it something like this:
var c = gdi.image("path" +var a + ".png")

I got it.

"path" is a string.
//////////////////////////codes below should work
var Path = fb.FoobarPath+"skins\\boo_boo\\";
var a = "test";
var c = gdi.image(path + a + ".png");

//////////////////now, c is the object of Image.
mad messy misanthropist morbid mused

WSH Panel Mod script discussion/help

Reply #666
just tell me how did you "put the var in another var".

well, I put it something like this:
var c = gdi.image("path" +var a + ".png")

I got it.

"path" is a string.
//////////////////////////codes below should work
var Path = fb.FoobarPath+"skins\\boo_boo\\";
var a = "test";
var c = gdi.image(path + a + ".png");

//////////////////now, c is the object of Image.


Thanks so far.
gonna test it when i get home.
<3 f00

WSH Panel Mod script discussion/help

Reply #667
@falstaff, Neonphytismo: I intended to said exit but wrote start instead, got a hang over, but I guess that helped me get an answer faster. Thanks both of you.

WSH Panel Mod script discussion/help

Reply #668
@falstaff, Neonphytismo: I intended to said exit but wrote start instead, got a hang over, but I guess that helped me get an answer faster. Thanks both of you.


Actually, I totally have no idea about how to use this callback function...
More exactly, I have no idea about most of those functions provided....
haha.
mad messy misanthropist morbid mused

WSH Panel Mod script discussion/help

Reply #669
I got it.

"path" is a string.
//////////////////////////codes below should work
var Path = fb.FoobarPath+"skins\\boo_boo\\";
var a = "test";
var c = gdi.image(path + a + ".png");

//////////////////now, c is the object of Image.


Neonphytismo,

I tried it but I get an Invalid procedure call or argument error.
I pasted the entire code below:

Code: [Select]
var NewPlayList;
function on_size() {
    ww = window.Width;
    wh = window.Height;
var   NewPlayList= utils.ReadINI(fb.FoobarPath + "foo\\WSH_scripts\\foo7.ini", 'Playlists', 'ChartName');
}

function on_playlists_changed(){
  var  NewPlayList= utils.ReadINI(fb.FoobarPath + "foo\\WSH_scripts\\foo7.ini", 'Playlists', 'ChartName');
window.Repaint();
}

var path = fb.FoobarPath + "foo\\f003\\BB\\";
var img = gdi.Image(path + NewPlayList +".png");
function on_paint(gr) {

gr.DrawImage(img, 10, 80 , 200, 75, 0, 0, 200, 75);
}
<3 f00

WSH Panel Mod script discussion/help

Reply #670
Oh,no.
NEW CODE:
var ww,wh;
Code: [Select]
var NewPlayList;
function on_size() {
    ww = window.Width;
    wh = window.Height;
NewPlayList= utils.ReadINI(fb.FoobarPath + "foo\\WSH_scripts\\foo7.ini", "Playlists", "ChartName");
}

function on_playlists_changed(){
NewPlayList= utils.ReadINI(fb.FoobarPath + "foo\\WSH_scripts\\foo7.ini", "Playlists", "ChartName“);
window.Repaint();
}

var path = fb.FoobarPath + "foo\\f003\\BB\\";
//var img = gdi.Image(path + NewPlayList +".png");

function on_paint(gr) {
var img = gdi.Image(path + NewPlayList +".png");
img && gr.DrawImage(img, 10, 80 , 200, 75, 0, 0, 200, 75);
}

Is IT?
Also, I recommend to use window.GetProperty() method, and String Data Type should only be quoted by " ";
mad messy misanthropist morbid mused

WSH Panel Mod script discussion/help

Reply #671
Also, I recommend to use window.GetProperty() method, and String Data Type should only be quoted by " ";


ok, I'm gonna look into that method, and change the quotes. Didn't know that makes a difference.
<3 f00

WSH Panel Mod script discussion/help

Reply #672
Neonphytismo

I looked into the window.GetProperty() method,
but it doesn't completely fulfill my needs.
The addition of the var ww,wh; and the doubblequotes, did however work perfectly.
Thank You very much!
This was something what was puzzling me for weeks.
 
<3 f00

WSH Panel Mod script discussion/help

Reply #673
Hi everybody!

Could somebody tell me why this isn't working:

Code: [Select]
 

fb.RunMainMenuCommand("View/Switch to playlist/"+source_playlist_name);
fb.RunMainMenuCommand("Select All");
lista = fb.GetSelections(1);


It finds right playlist, switch to it and selects all files but fb.getSelections() still doesn't find anything (lista.Count remains 0). How could I get all files from specific playlist (or better yet, all items from media library) to MetadbHandleList with WSH Panel Mod?

EDIT:
I added "var sel_type = fb.GetSelectionType();" after mainmenu command "select all" and the result was 4 (now playing) even though all the files at the desired playlist appear selected.

EDIT2:
fb.getselections() seems to work only when selection is focused (when I click on playlist with mouse and press Ctrl+A this works)