Thanks again marc.
For anybody else reading this thread looking for the exact same function, here is marc's WSH code fully tested and with helpful comments added
ready for your "copy-paste" pleasure into your own foobar2000:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
// * WSH Panel Mod script for foobar2000 *
// * by marc2003 *
// * *
// * 'ALWAYS ALIVE' TOOLBAR BUTTON *
// * which works independently of active, selected or playing states *
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//
// * Notes:
// Variables to use for retrieving relative path to foobar2000.exe:
// ("fb.FoobarPath" or "fb.ProfilePath") . "fb.ProfilePath" points
// to "%appdata%\foobar2000" in normal mode or the same as "fb.FoobarPath"
// in portable mode .
//
// * Important !!!!!!
// Go to "File->Preferences->Tools>WSH Panel Mod" and make sure safe mode
// is disabled . You need to do this if running external commands .
//
// * WSH Panel Mod Configuration:
// Script Engine ..............: JScript
// Edge Style .................: None
// Pseudo Transparent .........: Unchecked
// Grab Focus .................: Checked
// Delay Load .................: Unchecked
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
//////////////////////////////////////////////////////////////////////////
// PROGRAM DESCRIPTION: Launch a custom pop-up menu via a batch file //
//////////////////////////////////////////////////////////////////////////
var WshShell = new ActiveXObject("WScript.Shell");
//var img = gdi.Image("path\\to\\image.png");
var img = gdi.Image(fb.ProfilePath + "images\\M.bmp");
function on_paint(gr) {
// gr.DrawImage(img, left_margin, top_margin, width, height, 0, 0, img.Width, img.Height);
gr.DrawImage(img, 0, 0, 20, 20, 0, 0, img.Width, img.Height);
}
function on_mouse_lbtn_up(x, y) {
try {
//put your command in the quotes. if running a local file, remember to use double backslashes in the path like in the img line above.
WshShell.Run(fb.ProfilePath + "tools\\Menu-Launcher\\launcher.bat");
} catch(e) {
}
}