Skip to main content

Topic: WSH Panel Mod script discussion/help (Read 840481 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • onv
  • [*][*]
WSH Panel Mod script discussion/help
Reply #1825
@Falstaff

is it possible to add this option to a WSH Playlist Viewer (item.cover_type=2) ?


  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1826
@godrick

Code: [Select]
fb.TitleFormat("$strrchr(" + e_1 + "),_)").Eval();



  • danielkza
  • [*]
WSH Panel Mod script discussion/help
Reply #1827
A function I made to make my life a bit easier: it can register object methods to be called as if they were global callbacks. The following example will print 3 messages in the logs whenever the playback state is changed: one for each of the objects that registered their own callbacks in their constructors, and one for the global callback, that was properly stored before replacement. Get the actual code at github.

Code: [Select]
// Actual code ommited, grab the latest version from the link above!
// function registerFooCallbacks(obj);

function MyPlayMonitor(id)
{
   this.id = id;
   registerFooCallbacks(this);
};
MyPlayMonitor.prototype.on_play_order_changed = function(new_order_index)
{
   fb.trace("Play order changed! (id = " + this.id + ")");
};
MyPlayMonitor.prototype.on_playback_pause = function(state)
{
   fb.trace("Playback state changed! (id = " + this.id + ")");
};

function on_playback_pause(state)
{
   fb.trace("Global callback, reporting for duty.");
};

var play_orders = [new MyPlayMonitor("foo"), new MyPlayMonitor("bar")];
  • Last Edit: 14 September, 2012, 06:23:20 PM by danielkza

  • godrick
  • [*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1828
@godrick

Code: [Select]
fb.TitleFormat("$strrchr(" + e_1 + "),_)").Eval();


Wow, I should have been able to figure that out....but I didn't.  Thanks very much marc2003, once again!

  • Falstaff
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1829
@onv

possible yep, from me no, sorry, there are better things that are waiting to be done imho.
  • Last Edit: 15 September, 2012, 05:23:58 AM by Falstaff

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1830
samples updated: http://dl.dropbox.com/u/22801321/samples.zip

musicbrainz releases has been renamed to musicbrainz. this is because it has a new mode and that is to show some clickable links to various pages online. unlike my weblinks script which attempts to guess URLs based on artist metadata, these are all official pages. you can switch between releases and URLs via the context menu.

  • Last Edit: 18 September, 2012, 07:58:41 AM by marc2003

  • MrMonkey
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1831
Would it be possible to combine the artreader with the playback buttons so that the buttons are on top of the artwork and functional?
I previously did something similar with the normal artwork reader + rainmeter's NowPlaying plugin but it wasn't the cleanest solution.

I'm not asking for someone to do it - I'm just asking if it's possible.

Thx.
  • Last Edit: 18 September, 2012, 10:06:36 AM by MrMonkey

  • godrick
  • [*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1832
I think I'm out of luck of this, but I'll ask just in case:  I'd like to deselect options in the main foobar2000 toolbar in a js script. I tried fb.RunMainMenuCommand and fb.RunContextMenuCommand but no joy.  I wasn't surprised by that, since I understand those commands are limited to what you can select from the main menu and context menu for what is playing, and the toolbar selections are not normally available either of those ways.  I also looked through all the commands exposed by foo_runcmd and also did not find anything on point.  I'd like this to work for DUI, so I can't hide the toolbar or status pane as CUI does as has been discussed many times.

For what it's worth, I'd like to not display all main toolbar selections other than buttons when my display goes below a certain size, and restore the display of certain toolbars when the display goes above that size.  I'd settle for turning all toolbars off instead of selective control if that were the only option.

Is there something I'm missing, or a workaround other than use CUI?  Thanks for any advice as usual!

  • godrick
  • [*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1833
marc2003 and anyone interested - this is what I came up with to revise Thumbs to automatically download images for all artists in a multivalue artist tag field and other fields as defined in the code below.  If one wanted this to also work for multivalue composer or conductor tag fields, this could be changed to accommodate that easily.  The first function is an existing function revised to add a new call, and the following two functions are new.  No other changes to Thumbs - the artist field remapping selection still works as it did before.  Thanks for the help!


Code: [Select]
function on_playback_new_track() {
on_item_focus_change();
update_all_images();
}

// new function to update all artist, composer, conductor images
function update_all_images() {
crcs = [];
folderart = [];
num = fb.TitleFormat("$meta_num(artist)").Eval();
debug && fb.trace("Thumbs script:  " + num + "  total artists");
for(i =0; i < num; i++) {
  crcs[i] = fb.TitleFormat("$meta(artist," + i + ")").Eval();
  folderart[i]= data_folder + fb.TitleFormat("$crc32(" + crcs[i] + ")").Eval();
  debug && fb.trace("Thumbs script:  artist  " + i + "  " + crcs[i]);
  download_my_images();
}
crcs[i] = fb.TitleFormat("[%conductor%]").Eval();
if (crcs[i] != "") {
folderart[i]= data_folder + fb.TitleFormat("$crc32(" + crcs[i] + ")").Eval();
debug &&  fb.trace("Thumbs script:  conductor  " + crcs[i]);
download_my_images();}

crcs[i] = fb.TitleFormat("[%composer%]").Eval();
if (crcs[i] != "") {
folderart[i]= data_folder + fb.TitleFormat("$crc32(" + crcs[i] + ")").Eval();
debug && fb.trace("Thumbs script:  composer " + crcs[i]);
download_my_images();}

  debug && fb.trace("Thumbs script: completed downloading");
  update_image(); 
}

//borrowed from common4 and tweaked - custom function to download art
function download_my_images() {
working = true;
window.Repaint();
debug && fb.trace("Thumbs script:  downloading art for " + crcs[i]);
WshShell.Run('"' + script_path + 'art.exe" "' + crcs[i] + '" "' + folderart[i] + '" ' + limit, 0, true);
working = false;
}
  • Last Edit: 20 September, 2012, 01:41:43 PM by godrick

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1834
I'm not asking for someone to do it - I'm just asking if it's possible.


i've done it anyway - just a quick bodge together of the 2 scripts. http://dl.dropbox.com/u/22801321/art%20rea...k%20buttons.txt

Quote
I'd like to deselect options in the main foobar2000 toolbar in a js script.


i'm not really sure what you mean by this as you can't customise the menu in DUI. but you can re-create your own. look at the MainMenuManager All-In-One script bundled in the samples folder that comes with the component. this allows you to use only partial submenus such as file, view, help etc so you could omit ones you don't use but this is only useful for columns where you can hide the original toolbar.

  • godrick
  • [*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1835
Sorry for not being clear: within a js script, for a DUI layout, if any of the following toolbar items are displayed, I want to not display them when my foobar2000 display size goes below a certain size:
- layout editing mode toggle
- playback order
- playlist switcher
- any visualization
- volume control

... and then restore the ones from the list above that were previously displayed when the screen size increases.

Anyone have any experience with something like autohotkey to control these (i.e., commands not accessible from the main menu or context menu for what is playing)?
  • Last Edit: 21 September, 2012, 12:21:04 PM by godrick

  • MrMonkey
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1836
i've done it anyway - just a quick bodge together of the 2 scripts.

Amazing. Thank you so much.

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1837
small update to my musicbrainz script - http://dl.dropbox.com/u/22801321/samples.zip

it now has icons for the most popular websites...



(existing users need to extract the marc2003 folder again as it contains the new images)

@godrick, what you're asking is well beyond the scope of WSH panel mod.

panel stack splitter (for columns UI) can do this easily because you can hide the main toolbar and add each toolbar as a panel. you then have full control over what displays and what doesn't when panels are resized etc...

  • godrick
  • [*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1838
@godrick:

See references:
CalcTextHeight()
CalcTextWidth()

you'll probably want:
MeasureString()


I've struggled to find examples of any of these in an actual javascript to help me use them - if anyone has any js scripts that use these, or have written any js code to facilitate their use, it would be much appreciated if you could post or PM them to me.
  • Last Edit: 27 September, 2012, 10:36:22 AM by godrick

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1839
Code: [Select]
ww = 0;
wh = 0;
text = "some text and some more text bifsdfsdf sf s fsdfsdf sfsdfsf ";
font = gdi.Font("Segoe UI", 14);
colour = RGB(255,0,0);

function RGB(r, g, b) {
    return (0xff000000 | (r << 16) | (g << 8) | (b));
}

function on_size() {
    ww = window.Width;
    wh = window.Height;
}

function on_paint(gr) {
    gr.DrawString(text, font, colour, 0, 0, ww, wh, 0);
    line_length = gr.MeasureString(text, font, 0, 0, ww, wh, 0).Width;
    gr.DrawLine(0, 15, line_length, 15, 1, colour);
}

  • romka18
  • [*]
WSH Panel Mod script discussion/help
Reply #1840
Well, there is AutoitX3 and DynamicWrapperX ActiveX components.

With these to components only the sky is the limit. You can send messages, get system handles, create 'AERO' glass and so on.


can i with this addons create a callback for cdrom tray insert and drives changed (for example, inserted usb device, disk to cdrom or hdd)?


  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1841
samples updated: http://dl.dropbox.com/u/22801321/samples.zip

simple text reader now has a toggle on the right click menu to enable/disable fixed width fonts.

(existing users must extract the marc2003 folder again as well as importing the new script)

  • romka18
  • [*]
WSH Panel Mod script discussion/help
Reply #1842
i use window.repaintrect with constant size, but cpu loading depends on window size. is it normal?

  • godrick
  • [*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1843
marc2003, a belated thanks for the script showing MeasureString in actual js use.  I can't thank you enough for the help!

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1844
samples updated: http://dl.dropbox.com/u/22801321/samples.zip

no changes to scripts but the file foo_allmusic_mod.vbs inside the marc2003 folder has been updated to work with recent changes on the allmusic site. thanks to romor for his original script and providing this fix.

  • PeteG
  • [*][*]
WSH Panel Mod script discussion/help
Reply #1845
GdiDrawText-based text in panels doesn't automatically break words or phrases between e.g. () or "" nicely.
The parentheses and the quotation marks get widowed or orphaned:

Blah blah (
blah) blah.
Flip "flop
" flip flop.

The flag DT_WORDBREAK doesn't seem to handle (some?) glyphs and the like, or is the rub placed somewhere else?
Is it doable in JS or VBS to write a simple function that takes care of these situations?
As far as I can see, MSDN doesn't provide any solutions.
My limited mental capabilities prohibit me from composing a usable search string and google for a solution .

I'm very grateful to marc2003 for especially the Artreader and Allmusic scripts and of course to T.P Wang for making all this possible.
It's great fun reading the WSH fora.
(I'm not a programmer any more, it's 25 years since I made my last endless loop on a mainframe ... this GDI stuff is indeed terra incognita).
  • Last Edit: 10 October, 2012, 02:30:00 AM by PeteG

  • romka18
  • [*]
WSH Panel Mod script discussion/help
Reply #1846
in new version (v1.5.5.1) this doesnt work:

Code: [Select]
//GetDeviceInfo by GiveMe9 http://www.hydrogenaudio.org/forums/index.php?showtopic=70363&view=findpost&p=770121
var wbemFlagReturnImmediately = 0x10;
var wbemFlagForwardOnly = 0x20;
//SoundDevice
g_text = "SoundDeviceInfo";
var objWMIService = GetObject("winmgmts:\\\\.\\root\\CIMV2");
var colItems = objWMIService.ExecQuery("SELECT * FROM Win32_SoundDevice", "WQL",wbemFlagReturnImmediately|wbemFlagForwardOnly); //<<<<<---error there
var enumItems = new Enumerator(colItems);
for (; !enumItems.atEnd(); enumItems.moveNext()){
    var objItem = enumItems.item();
    g_text += "\nProductName:"+objItem.ProductName;
    g_text += "\nstatus:"+objItem.Status;
}
//END_GetDeviceInfo


any way to solve this problem?

also doesnt understand how custom tooltip works - cant put normally string on it
  • Last Edit: 10 October, 2012, 03:02:24 AM by romka18

WSH Panel Mod script discussion/help
Reply #1847
With the seemingly apparent death of foo soft Playlists... I'm wondering if any of you WSH script wizards could conjure up an easy way to aggregate a last. Fm user's loved tracks onto a Playlist. I relied heavily on this to as a quick and easy way update my tracks that had not yet been tagged in foobar as loved.
  • Last Edit: 10 October, 2012, 08:15:17 AM by Fractal_Mortality

  • romor
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1848
Here is stylesheet (xspf.xslt) that transforms last.fm XML response to XSPF playlist: view or download

CLI Usage: msxsl lastfm-response.xml xspf.xslt -o lastfm-response.xspf

where lastfm-response.xml is response from i.e.:

Code: [Select]
GET http://ws.audioscrobbler.com/2.0/?method=user.getlovedtracks&user=some_user_name&api_key=some_api_key

Of course it's not limited to just 'user.getlovedtracks' call

Some thoughts:

- obviously there is no other way, except XSPF, to reference tracks w/o providing track location
- foo_softplaylist is the only component able to handle XSPF paired to local library (I've done this in COM server component by iterating library, but it's not that great)
- user has to access menu (load xspf...) and browse to XSPF location, to be able to see result
- I have no idea if msxsl tool comes by default with Windows or I got it from office or by d/l msxml tools, anyway it's not necessary for end user to have this tool, as XSLT can be easily done with WSH, this is just one raw possibility with a small battery inside
- maybe foo_softplaylist developer will wake up in the meantime
  • Last Edit: 10 October, 2012, 10:17:45 AM by romor

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1849
GdiDrawText-based text in panels doesn't automatically break words or phrases between e.g. () or "" nicely.
The parentheses and the quotation marks get widowed or orphaned:

Blah blah (
blah) blah.
Flip "flop
" flip flop.

The flag DT_WORDBREAK doesn't seem to handle (some?) glyphs and the like, or is the rub placed somewhere else?


if you're talking about my scripts, then the problem is indeed elsewhere. i'm using the WSH panel mod EstimateLineWrap function which seems to be the cause of this problem. the reason i started using this is to get an accurate height for long bodies of text so i can control when to stop scrolling.
  • Last Edit: 15 October, 2012, 05:00:28 AM by marc2003