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 801571 times) previous topic - next topic
0 Members and 2 Guests are viewing this topic.

WSH Panel Mod

Reply #1375
Suggestion : MetaDBHandles from Library

Hi again. Now a real suggestion.
Would it be possible to add some way to get an IFbMetadbHandleList directly from the library rather than a playlist.
According to this thread in the developpers forum, there are methods (library_manager::enum_items() or library_manager::get_all_items() )to do this. However i don't know how, or even if they can be used to create a WSH method as i know nothing of C++ prgramming.
Such a method could be used to code a library browser in WSH without dirty trick like creating a temporary auto-playlist.


WSH Panel Mod

Reply #1377
Is there a simple way to draw rotated text?
Also! Is there a way to access the current playback mode?
My aim is to draw "REPEAT" or "LINEAR" or whatnot vertically along the left side of my playlist, so it takes up the least room and adds variety to the otherwise overwhelmingly horizontal layout I have going on.

One last question, is there a way to get rid of the ever so faint light gray border on between my panels that show up even if the 'border style' property is set to none on Win7?

WSH Panel Mod

Reply #1378
Is there a simple way to draw rotated text?
simple, no. But possible to write text in an image object (have to be defined first), then when image done, draw it with the desired angle

e.g.
Code: [Select]
    // declare globals variable
  var image;
  ....

    // in a function called once on script launching, create the image ...
    image = gdi.CreateImage(70, 25);
    gb = image.GetGraphics();
    var font = gdi.Font("tahoma", 10, 0);
    gb.SetTextRenderingHint(5);
    gb.DrawString("REPEAT", font, 0xff000000, 0, 0, 70, 25, cc_stringformat);  // cc_stringformat is to be defined (alignement... check WSH doc of DrawString api)
    image.ReleaseGraphics(gb);
    ....

    // then in on_paint function, you'll be able to draw this image but with a rotate of 90° ....
    var angle = 90;
    gb.DrawImage(image, 100, 100, 70, 25, 0, 0, 70, 25, angle, 255);
    ....

Also! Is there a way to access the current playback mode?
read the doc (interfaces.txt), extract:

    // Known playback orders:
    //      Default: 0,
    //      RepeatPlaylist: 1,
    //      RepeatTrack: 2,
    //      Random: 3,
    //      ShuffleTracks: 4,
    //      ShuffleAlbums: 5,
    //      ShuffleFolders: 6
    (read, write) uint PlaybackOrder;

so just use in your script fb.PlaybackOrder

One last question, is there a way to get rid of the ever so faint light gray border on between my panels that show up even if the 'border style' property is set to none on Win7?
the only way to remove visible splitters (their colors math the windows visual style colors (button face)) is to use Panel Stack Splitter component for ColumnsUI. in DUI, you can't get rid off these splitters.
http://www.hydrogenaudio.org/forums/index....showtopic=62114

HTH


WSH Panel Mod

Reply #1379
Is it possible to create a button to run another program by click on it?

I'm able to create the button but don't know how to run the programm:

Buttons.a = new Button(0, 22, 58, 14, {normal: imgPath + "AddOnLeft.png", hover: imgPath + "AddOnLeftMH.png"}, function(){??????????SOMETHING???????????});

thank you all!

WSH Panel Mod

Reply #1380
var WshShell = new ActiveXObject("WScript.Shell");

Buttons.a = new Button(0, 22, 58, 14, {normal: imgPath + "AddOnLeft.png", hover: imgPath + "AddOnLeftMH.png"}, function(){WshShell.Run("notepad.exe")});

WSH Panel Mod

Reply #1381
var WshShell = new ActiveXObject("WScript.Shell");

Buttons.a = new Button(0, 22, 58, 14, {normal: imgPath + "AddOnLeft.png", hover: imgPath + "AddOnLeftMH.png"}, function(){WshShell.Run("notepad.exe")});


Thank you very much!

I got this error an error at line 13, so this line:

var WshShell = new ActiveXObject("WScript.Shell");




WSH Panel Mod

Reply #1384
Is it possible to use fb.Titleformat to set a var which can be used everywhere in foobar?
For example set a var test with a value abc:

fb.Titleformat("$puts(test,abc)");

And than use anywhere else in foobar $get(test) to retrieve that value?

<3 f00

WSH Panel Mod

Reply #1385
There was a time when you could do pretty much anything in titleformatting hooks. That time is thankfully long gone.
Stay sane, exile.

WSH Panel Mod

Reply #1386
There was a time when you could do pretty much anything in titleformatting hooks. That time is thankfully long gone.


hmm,  I wanted to pass the playlist name to the default playlist view.
Nothing serious
<3 f00

WSH Panel Mod

Reply #1387
I'm having a weird problem with gdi.Image. I've got the following four lines in the global declarations of my script:
Code: [Select]
pref["bg_image"]   = fb.ProfilePath+"images/WSHtpc04/wallpaper-blueish.jpg";
pref["settng_img"] = fb.ProfilePath+"images/WSHtpc04/settings.png";

var image_bg      = gdi.Image(pref["bg_image"]);   // background image
var settingsImg   = gdi.Image(pref["settng_img"]); // settings image


When I make changes to the script and hit OK or Apply both images appear just fine. When I close and reopen foobar, or switch between configs and back (i.e. loading the script in ANY other manner than OK/Apply) image_bg displays just fine, but settingsImg does not.

I put the following check in on_init():
Code: [Select]
    if (settingsImg == null) {
        fb.trace("settingsImg was null");
        settingsImg = gdi.Image(pref["settng_img"]);
        }

The trace line gets hit, but settingsImg still doesn't display. settingsImg is NEVER assigned anywhere else except the on_init or declaration. Anybody have any ideas? Is it because it's a .png?

And yes, I'm disposing and nulling both images in on_script_unload().

WSH Panel Mod

Reply #1388
Figured it out. My on_init function is not a standard callback, just a function that gets called when the script loads. It calls on_size() manually which apparently doesn't have a window setup so Window.Width and Window.Height are both 0, therefore the image was being positioned offscreen because I was offsetting it from the right edge. Guess that's the dangers of editing from someone elses scripts.

WSH Panel Mod

Reply #1389
WSH Panel Mod v1.5.4 is released, this is a maintenance build.

In the upcoming release (1.6.0 maybe), I'm considering separating scripts into files that allow users to choose their favorite editors , and, make changes while scripts stuck at start up.

For the library thing, I still have no plan to add these apis in the near future, sorry.

WSH Panel Mod

Reply #1390
fb.CursorFollowPlayback and fb.PlaybackFollowCursor don't appear to be writeable. i can easily workaround this by using the main menu commands but i just thought i'd report it as the docs do say you can both read and write.....

WSH Panel Mod

Reply #1391
@marc2003:
This is my test case, but I cannot reproduce your problem:
Code: [Select]
var bk_PlaybackFollowCursor = fb.PlaybackFollowCursor;
var bk_CursorFollowPlayback = fb.CursorFollowPlayback;

fb.PlaybackFollowCursor = !bk_PlaybackFollowCursor;
fb.CursorFollowPlayback = !bk_CursorFollowPlayback;

var error = false;
var message = "";

if (fb.PlaybackFollowCursor == bk_PlaybackFollowCursor) {
    message += "[ERROR] PlaybackFollowCursor cannot be assigned.\r\n";
    error = true;
}

if (fb.CursorFollowPlayback == bk_CursorFollowPlayback) {
    message += "[ERROR] CursorFollowPlayback cannot be assigned.\r\n";
    error = true;
}


if (!error) {
    message = "[INFO] It seems that PlaybackFollowCursor and CursorFollowPlayback both work."
}

fb.ShowPopupMessage(message, "Test Case");

My guess is that some other things prevent you from changing these.

WSH Panel Mod

Reply #1392
it's me being a complete idiot again. i realised pretty much straight away after i posted what i had done wrong but i couldn't get back to a computer until today. sorry for wasting your time. 

WSH Panel Mod

Reply #1393
i'm very pleased to see a new release of my favorite foobar2000 component  thanks T.P

I've a question and if possible a request

is it possible to get the color of a pixel of an image object? i'd like to draw a background with a color close to the album art color : by resizing the cover image to the size of 1x1 pixel, i think it will give me the main color of a cover, and if WSH panel mod could provide a method to get the color of this pixel, i could grab it and then use it ...

so, is it possible and so could you think about it for the v1.6.0 ^^'

thanx by advance for your feedback T.P

Cheers and long life to WSH Panel Mod


WSH Panel Mod

Reply #1395
I'll avoid adding methods like GetPixel(), its likely to be abused...
The best method for your need is a color scheme generator, I'll have a look later.

WSH Panel Mod

Reply #1396
hmm, you're maybe right, it's too "touchee" ^^

all other idea for the wanted result are of course very welcome, thanx T.P.

WSH Panel Mod

Reply #1397
On the topic of pixels, I've been trying to align text and images in scripts that maintain alignment as string length and font sizes change for different image and screen sizes, but without success. The .length of a string just provides the length in characters, not pixels as I desire.

I searched for something to do this, but could only find examples that seemed specific to HTML, and this approach , which i'm still trying to absorb.

Any advice on how to determine the pixel length of a string within a WSH script is appreciated.  If there is no existing straightforward way, then it would be great to have the ability to do so via a future panel mod function.  Thanks!

WSH Panel Mod

Reply #1398
@godrick:

See references:
CalcTextHeight()
CalcTextWidth()

you'll probably want:
MeasureString()

WSH Panel Mod

Reply #1399
always about my Quest to grab color of a pixel (i've found a way to grab a pixel as an image to aply it as a biger image for an overlay color),

is there a way to compare 2 images object ?

@T.P. Wang: it's maybe a more acceptable method to add to GdiBitmap object than a getPixel one ? what about it ?