The reason it won't work is that you need access to the gr object in order to call the function gr.SetTextRenderingHint(...). This access is granted by gr being provided to the on_paint function as a parameter.

I see.... So I can't put "SetTextRenderingHint(5);" instead to make it a global setting either I take it?

Is there a way, in a WSH panel, to get information (%title%, %album%...) about the song to be played next in the playing playlist (assuming the playback order is default, of course) ?

I'm trying to write a panel for a "Stop after Album" button but for now all I can do is to compare the track number of the playing track with the %totaltracks% defined for the track that was playing when I triggered the button (sorry if I'm not clear)

Most of the time it works but sometimes no: if there is no %totaltracks% defined or if, in my playlist, the last song from one certain album to be played (before playing another track from another album) is not the actual last track of this album (for with %tracknumber% == %totaltracks%)

I added fb.RunMainMenuCommand("View/Show Toolbars") to my on_init which works great, but there's no way to determine whether the toolbars were toggled on or off. It always just returns true. I'm assuming the answer is no, but is there any way to get the check state of the menu command first?

Hello. This time i'm not here for another stupid noob question . I have finally been able to get my WSH_browser to a working state.This is a "graphical" (well, not really for now but it will become) library browser component for WSH panel mod. ) is the most efficient way to browse the library. It works but there might be something more elegent (such as working with an autoplaylist, but then i would have to get metadbhandles several times later).@Fallstaff i would be really happy to know what you think of my approach as you have experience with sorting lots of tracks in WSH. I had a look at your CoverFlow but didn't really understood how you are storing the handles in groups. I was unable to store handles directly in an array so i had to create several IFbMetadbHandleList objects.

but ... first try, it doesn't work ==> foobar2000 not responding (for 5 minutes now....), my libray is big (~40k trks), i suspect your script is not for large library, but what's its maximum size to make it work?

before checking a script, i'd like to see it running well, if not, i'm not interrested ... other stuff is waiting, so i'll wait a next version of your script maybe with some restrcitions info in comments to indicate in which way somebody can test it

EDIT: hmm, works better on another try, lag just the time to populate the WSH playlist... i'll check your script asap. Careful, mousewheel make content disapear...

Wow! Thanks for the speedy replies! Unfortunately for me, I have no scripting knowledge and do not fully comprehend the WSH Panel Mod.I have a specific UI Layout and settings that never change on my player. I need to keep this layout and settings while adding the described option in this old post of mine...** My only issue with foobar2000 is that I don't have visual notification when I have activated a "Stop After Current" command.

In my use, I have playback follows cursor. It would be great to have the highlighted cursor able to change color to red when stop after current is selected. **

If someone out there is willing to create a script for me, and walk me through the setup, I would be more than happy to make a donation for their services to their PayPal account. Please send a PM if interested.Thanks.

Not possible, because we cant get media library MetadbHandleList to WSH panel mod.

you can't say that. It's possible through another way based on a playlist that contains the library, but for sure this method is not perfect because this playlist has to be populated before being available for the script.

but ... first try, it doesn't work ==> foobar2000 not responding (for 5 minutes now....), my libray is big (~40k trks), i suspect your script is not for large library, but what's its maximum size to make it work?

Not sure what the maximum size is. My library is about 4500 tracks so much smaller than yours and this script has only been tested on my computer so far. Well, that's a feedback on it's own so i know i need to improve the way i gather handles.

Quote

before checking a script, i'd like to see it running well, if not, i'm not interrested ... other stuff is waiting, so i'll wait a next version of your script maybe with some restrcitions info in comments to indicate in which way somebody can test it

EDIT: hmm, works better on another try, lag just the time to populate the WSH playlist... i'll check your script asap. Careful, mousewheel make content disapear...

I understand. I'll be improving it anyway. As stated i consider it an alpha, not even a beta, but i posted it anyway because a single experienced hint might improve the script more than one week of my noob work In the current script, i have a check to prevent mousewheel from scrolling before line 1 but nothing to prevent it from scrolling past last line (this one has to be calculated first). Scrolling up should bring content back if you go too far. This will be added by the time i release the first "beta".

Not possible, because we cant get media library MetadbHandleList to WSH panel mod.

you can't say that. It's possible through another way based on a playlist that contains the library, but for sure this method is not perfect because this playlist has to be populated before being available for the script.

That's exactly the workaroud i used to gather the MetadbHandleList in my browser above. Actually, here is what i did (so you don't have to look at my code).

I have defined a MetaDB custom object constructor. In my script i create such an object. It has the following properties :

ownId : this is simply it's name so i can refer it in console output.

query : the query used to retrieve tracks. By default it's a single dot (.) that will get everything.

sortBy : how to sort tracks

groupBy : how to group tracks (eg : by genre)

groups : an object containing group names based on groupBy (eg. Rock) and metaHandles sub-lists (those are full IFbMetadbHandleLists objects as i wasn't able to store metaHandles in simple jscript arrays).

The following methods are available :

doListHandles : will retreive MetadbHandles from the library matching the query. Actually it will create a temporary auto-playlist with said query. Get all MetadbHandles then remove the auto-pl. It's quite an ugly workaround but it works, at least on small to medium libraries . MetadbHandles are stored twice, one as a "working" set and one as a "backup" set. I'm not sure how this impacts memory use and performances with big libraries. According to Falstaff's tests it's not working very well.

doResetHandles : will reset the "working" set to match the "backup" set

doFilterHandles : will filter the "working" set to exclude MetadbHandles not matching a filter passed as argument.

doGroups : will sort the MetadbHandles from the "working" set and store copies of them in the groups object (MetadbHandles are thus stored three times, i hope they are not big memory eaters:unsure:)

getGroups : will return the names of the groups to the script so they can be used to get the tracks in other statements.

I'm quite sure i can improve this, and of course it would be nice to skip the playlist step altogether (a probable cause of some delay with big libraries).

My browser could probably be modified to show a tree view. I might add it later, but it's currently an early alpha and i won't add features until it's working smoothly on bigger libraries and the current features and interface are polished enough.

In my system (core2duo E7400 2GB ram winxp) and with my 57000 tracks library, it works from the first run. There is a lag of about 5 seconds switching from alphabetic and genre view, like that switching in ColumnsUI filters; only facets in DUI is faster. I like your project because i need a simple interface to easily control with a 7" touchscreen monitor, but i'm not a programmer and my last one

) is very slow and not much user-friendly...I can't help you in programming, but if you need a beta-tester with a large library... I'm here Good work Fabio

Thanks for the encouragement and feedback.Actually, i didn't even think about touchscreens but i can see how a simple visual interface can be useful for those. I'll try to keep them in mind for further developpment."Beta test" will be open, so you are free to participate

Well, speaking of my script, i'm running into a bad hang currently. I'm trying to get the path that's common to all items in a group, in order to search this path for artwok to show (artist picture, album cover ...) and avoid the need to keep a copy of every artwork inside the artwok folder where non-path related artwork (eg genres will be kept). However my code is making foobar2000 hang idefinitely (like i'm running an endless loop )

// Search for a common path to all items in the group. __path = __hnd.Path; if (this.groups[__groupName].path) { // if true there is already a path stored, find common path __path = __path.split("\\"); // Split into an array of folder names. __pathOld = this.groups[__groupName].path.split("\\"); for (var i = (__path.length-1); i>=0; i--) { // Check every item, starting by the end if (i >= __pathOld.length) { // if current path is longer than stored path void __path.pop(); // remove last item from current path continue; // begin next iteration } else if (__path[i] == __pathOld[i]) { // compare last item of stored and current path this.groups[__groupName].path = __pathOld.join("\\"); break; // break the loop and keep the path as it is now } else { void __path.pop(); // reduce the path one level towards the root void __pathOld.pop(); } } } else this.groups[__groupName].path = __path; // store path of the first track

And more precisely, the for loop part. It shouldn't loop forever, i'm decresing i at each loop and the condition is i>=0.Can someone tell me what noobish mistake i made?

re: while loopI try to stay away from while loops as they seem more prone to endless loop (they are easier to code badly ) but i see the logic behind your example. I wouldn't have thought of grouping the condition and the increment/decrement. Thanks.

@FalstaffI already have some console output, thought not at this place. But i can't look at the console as fb2k itself will hang, not just the panel EDIT : never mind, just found the "write log" checkbox in the console.EDIT 2 : nay, even with "write log" checked, i don't get any console output at all when hangs occur. Not even output from statements that are executed before the loop goes crazy (actually : write log is not kept when fb2k restarts.

I tried to compare strings directly with what looks like simpler code, but i still have an endless hang. Got it working!

Is there a way, in a WSH panel, to get information (%title%, %album%...) about the song to be played next in the playing playlist (assuming the playback order is default, of course) ?

I've used the following function to add a stop-after-album feature. The important parts are plman.GetPlaylistItems(plman.PlayingPlaylist), which give you the playlist's tracks in order, and plman.GetPlayingItemLocation().PlaylistItemIndex, which gives the index of the current track.