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

WSH Panel Mod script discussion/help

Reply #1200
Thanks for your patience! And one final request - code also to look in subfolders?

WSH Panel Mod script discussion/help

Reply #1201
you'd have to specify them manually by name (or title formatting). eg

Code: [Select]
$directory_path(%path%)\images


tiny little bugfix for my autoplaylists script. http://dl.dropbox.com/u/22801321/samples.zip

WSH Panel Mod script discussion/help

Reply #1202
samples updated. link as above.

nyan cat seekbar and simple seekbar now use a tooltip to show the seek time. thanks to T.P for the new tooltip tracking code.

requires WSH panel mod 1.5.0 beta4 (or later)

edit: forgot to mention for existing users, the marc2003 folder needs extracting again as background changes have been made.

WSH Panel Mod script discussion/help

Reply #1203
nyan cat seekbar 

WSH Panel Mod script discussion/help

Reply #1204
After a few days of playing with JScript and WSH panel, I've created a simple playlist switcher with the following features:
  • drag to switch playlist order
  • drag and drop support
  • double-click to rename (or press F2 after focusing)
  • mouse wheel to switch playlists


http://pastie.org/2783951

Feel free to comment/reuse/modify!

WSH Panel Mod script discussion/help

Reply #1205
i'll give it a try asap, to compare it with mine which provides same features. Thanx for sharing.

WSH Panel Mod script discussion/help

Reply #1206
simple text reader added to samples. it only has 2 options on the context menu: the path to the file which can be full foobar title formatting and selection mode (now playing or selected track). file extension doesn't matter so long as it is plain text. colours and font come from your UI preferences. although it has buttons to scroll, using the mouse wheel is far quicker.

http://dl.dropbox.com/u/22801321/samples.zip



WSH Panel Mod script discussion/help

Reply #1207
How can I get the playlist context menu (with options to change autoplaylist options, save, etc)? I guess it has something to do with the InitContext() function, but I don't know how to use it.

WSH Panel Mod script discussion/help

Reply #1208
How can I get the playlist context menu (with options to change autoplaylist options, save, etc)? I guess it has something to do with the InitContext() function, but I don't know how to use it.


here is an example used under WSHPanelMod v1.5.0  to get context on the selection (one or more item selected), it should help you with InitContext

Code: [Select]
//=========// Item Context Menu
function new_context_menu(x, y, id, array_id) {
    var MF_STRING = 0x00000000;
    var MF_SEPARATOR = 0x00000800;
    var MF_GRAYED = 0x00000001;
    var MF_DISABLED = 0x00000002;
          
    var _menu = window.CreatePopupMenu();
    var Context = fb.CreateContextMenuManager();
    Context.InitContext(plman.GetPlaylistSelectedItems(fb.ActivePlaylist));
    Context.BuildMenu(_menu, 1, -1);

    var ret = _menu.TrackPopupMenu(x, y);
    Context.ExecuteByID(ret - 1);

    }
}

WSH Panel Mod script discussion/help

Reply #1209
falstaff, i think you've mis-understood the question although he has confused things by mentioning InitContext . i believe jermija wants the context menu you get when right clicking on playlist tabs or the playlist manager view. you''ll just have to build that menu manually.

WSH Panel Mod script discussion/help

Reply #1210
Thank you both! Yes, marc2003 is right, but what's bothering me is that I don't know how to access/launch the autoplaylist options dialog.

WSH Panel Mod script discussion/help

Reply #1211
read the docs.  you can tell if a playlist is an autoplaylist by using

Code: [Select]
var active = plman.ActivePlaylist; 
if (fb.IsAutoplaylist(active)) _menu.AppendMenuItem(MF_STRING, 10, "Autoplaylist properties");


then later on....

Code: [Select]
idx = _menu.TrackPopupMenu(x, y);
switch(idx) {
    case 10:
        fb.ShowAutoPlaylistUI(active);
        break;


edit: i just realised you probably won't be using the active playlist like my example but you'll have your own mouse tracking code to get the selected playlist.

WSH Panel Mod script discussion/help

Reply #1212
Thank you very much!  Didn't know about the ShowAutoPlaylistUI() method...

WSH Panel Mod script discussion/help

Reply #1213
Thank you Marc for all these samples, I use many of them and love them a lot. Especially the thumbs script is so great!

Now, I'm a totally newbie at jscript and most of the things I can accomplish are done with copy & paste from scripts and a lot of trial and error...but now I have a question I simply cannot find a step into the right direction.

I would love to display the filename of the image (main image) from the thumbs plugin. Or even all, doesnt matter. Now I'd need a hint into the right direction...I know how to write a string (I guess) but as to how to retrieve the filename, I am totally lost.

WSH Panel Mod script discussion/help

Reply #1214
well the full path to the main image is stored in arr[index]. you'll want to grab this value in on_paint because the value of index can change whenever the mouse is moved. then to get the filename we can get the string from the last backslash to the end.

Code: [Select]
file_path = arr[index];
file_name = file_path.substring(file_path.lastIndexOf("\\") + 1);


WSH Panel Mod script discussion/help

Reply #1215
Thanks so much for your reply, I will try this out now!


WSH Panel Mod script discussion/help

Reply #1217
Uhm. Okay, I have to admit I couldnt get the filename stuff done. It seems, wherever I put that second line, the script returns an error.
But Marc, you don't have to do it for me, I read somewhere you are about to move house, and I can imagine you have your hands pretty full.
I should really start trying to learn at least basics of Jscript, but right now it is no good timing (too much real life stuff going on).

But I have another request 
I would really really love a very simple recent tracks script. Right now I am using an old one from someone else; the code is not compliant with the wsh mod changes and I *think* it might be part of a problem I currently have with refresh of the scripts - they dont load at start of foobar. I have the wsh scripts in a PSS with custom code, but I had the author of the PSS script look into the code again to see if I messed something up and he couldnt find a mistake. It is no big deal really, as soon as I right-click the PSS, click settings and hit okay (without changing anything) the wsh scripts load fine.
Maybe you get the chance to write something like that after your move?

WSH Panel Mod script discussion/help

Reply #1218
Hello! I have some questions:

i need for a callback, which will execute some script when i put in my usb player or cd. I havant any idea, except to check number of drives on timer, but i think it bery busy for cpu.

i need to new a cpu`s count (with hyper threading)

for example i launch the lame.exe encoder. how could i now that he already done his task?

is it possible to get a list of javascript files (js) in some folder and include them?

i will be very glad if this issues have any way to solve

WSH Panel Mod script discussion/help

Reply #1219
also, i want to ask: is it possible to read and edit foobars core cfg-files through wsh?

WSH Panel Mod script discussion/help

Reply #1220
@Emerelle, those lines i gave need to go inside the switch statement when it's established there is at least one image in the array. one that beings case thumbnails == would be good.

or if you don't want it inside the switch statement, check the arr array contains at least one value...

Code: [Select]
if(arr.length > 0) {
//do something
}

WSH Panel Mod script discussion/help

Reply #1221
Can someone help me using the new AppendTo method?

This is a sample code:
Code: [Select]
function CustomMenu(x, y) {
var a = window.CreatePopupMenu();
var idx;

a.AppendMenuItem(0, 1, "Keep aspect ratio");
a.AppendMenuItem(0, 2, "Noexpansion");
a.AppendMenuItem(0, 3, "Stretch");
a.CheckMenuRadioItem(1, 3, ar + 1);
a.AppendMenuItem(2048, 0, 0);
a.AppendMenuItem(0, 4, at ? "Album Art" : "Custom Pictures");
a.AppendMenuItem(2048, 0, 0);

if (!ac) {
for (var i = 0; i < c_arr.length; i++) {
a.AppendMenuItem(0, 5 + i, c_arr[i]);
}
a.CheckMenuRadioItem(5, 9, g_state + 5);
a.AppendMenuItem(2048, 0, 0);
}

a.AppendMenuItem(ac ? 8 : 0, 10, "Auto Cycle Image");
ac && a.AppendMenuItem(ct ? 8 : 0, 11, "Faded Transition");
a.AppendMenuItem(2048, 0, 0);
a.AppendMenuItem(0, 12, "Properties");
a.AppendMenuItem(0, 13, "Configure...");

idx = a.TrackPopupMenu(x, y);

switch (true) {
case (idx >= 1 && idx <= 3):
window.SetProperty("Aspect ratio", idx - 1);
aspectRatio();
window.Repaint();
break;

case (idx == 4):
switchType();
break;

case (idx >= 5 && idx <= 9):
g_state = idx - 5;
getRightImage(false);
getTimer();
break;

case (idx == 10):
window.SetProperty("Auto Cycle Image", ac ? false : true);
ac = window.GetProperty("Auto Cycle Image");
break;

case (idx == 11):
window.SetProperty("Auto Cycle Transition Fader on", ct ? false : true);
ct = window.GetProperty("Auto Cycle Transition Fader on");
break;

case (idx == 12):
window.ShowProperties();
break;

case (idx == 13):
window.ShowConfigure();
break;
}

a.Dispose();
}
How to rewrite it now by using AppendTo instead of AppendMenuItem?
Or is this new method only needed for the MainMenuManager (since its the only sample script that uses it now) to create the main menu?
I'm confused...

WSH Panel Mod script discussion/help

Reply #1222
you only use AppendTo when creating sub-menus.

an example:

Code: [Select]
old:
_menu.AppendMenuItem(MF_STRING | MF_POPUP, _child.ID, "Background");

new:
_child.AppendTo(_menu, MF_STRING, "Background");

 

WSH Panel Mod script discussion/help

Reply #1224
Ok, so in my script sample there's no need to replace. Thanks!

EDIT:
Again a question...

How to use the new window.SetInterval() and window.SetTimeout()?
I tried replacing window.CreateTimerInterval(50) with window.SetInterval(50) but got a crash...
What's wrong?