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 814843 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

WSH Panel Mod

Reply #750
^I knew the issue, it will be improved in the next beta, I'm considering whether to break the older version upward computability or not.

 

WSH Panel Mod

Reply #751
can someone post a code snippet on how to use fb.GetSelection?

WSH Panel Mod

Reply #752
can someone post a code snippet on how to use fb.GetSelection?

After some playing around it works quite well, but it behaves a little bit strange: for example if ones skips a track on_selection_changed(metadb) is called twice (first with metadb = null and GetSelectionType() giving 0).

Anyway this is how I use it now:
Code: [Select]
var followplayback = false;
var cmetadb = fb.GetFocusItem(true);
var fileinfo = cmetadb.GetFileInfo();
window.WatchMetadb(cmetadb);

//callbacks

function on_selection_changed(metadb) {
    if (metadb && !(fb.GetSelectionType() == 4 && !followplayback)) {
        cmetadb = metadb;
        fileinfo = cmetadb.GetFileInfo();
        window.WatchMetadb(cmetadb);
        window.Repaint();
    }
}

And then I have a button to switch between following now playing file or not:
Code: [Select]
function ButtonFollowPlayback(check) {
    if (arguments.length == 0) {
        return followplayback;
    } else {
        followplayback = check;
        if (check && fb.GetSelection()) {
            cmetadb = fb.GetSelection();
            fileinfo = cmetadb.GetFileInfo();
            window.WatchMetadb(cmetadb);
        }
    }
}

WSH Panel Mod

Reply #753
^i can't see the point of that at all? i think fb.GetSelection should only be used when you're forcing the use of the foobar display preferences without a panel preference (like tedgo asked for).

if you're going to provide your own toggle you might as well use the old methods...

Code: [Select]
//now playing. (use selected item when playback is stopped)
g_metadb = fb.IsPlaying ? fb.GetNowPlaying() : fb.GetFocusItem();

//selected item
g_metadb = fb.GetFocusItem();





WSH Panel Mod

Reply #754
I wrote it this way because it requires relatively little code and I wanted to be able to suppress it when I am editing a tag.

WSH Panel Mod

Reply #755
@TP Wang: Tahnks for the last version. I dont know if you did it on purpose but my scripts dont crash anymore on startup 
Now i have another question about foobar startup.
This a part of the code i use
Code: [Select]
function reloadConf(inipath)
{
    skinpath = translatePath(utils.ReadINI(inipath, "SKIN", "imgpath", ""),true);
   
    ///progressbar
    var pbw = window.width - 135;
    var pbh = 12;
    var pbx = window.width/2 - pbw/2;
    var pby = window.height - pbh - 4;
    np_progbar = new ProgressBar(pbx, pby, pbw, pbh);
   
    ///rating
    np_rating = new Rating(window.width - pbx + 3, window.height -17, skinpath);
   
    //lovebutton
    np_lovebutton = new LoveButton( 3, window.height -22, skinpath);
 
    on_item_focus_change();
}

reloadConf(inipath);
My problem is that when foobar starts my objects np_lovebutton , np_rating  and np_progbar are not created. Then when i open the script config and click ok, the objects appear. May be you can help me figure out what i am doing wrong.

Thanks again for all your hard work.

WSH Panel Mod

Reply #756
@carmenm:
See Notes & Hints #6.

WSH Panel Mod

Reply #757
IMainMenuManager only accept main menu root menu items (File, Library, etc), no submenu items.


Is there any hope for submenu support to be added?  I'd really like to implement a playlist switcher drop-down menu, and using the "View > Switch to playlist" submenu is the only way I can think to implement it.  If there's another way, I've love some details.  Though, even if there is, I'd still love to see submenu support so I can add the foo_softplaylists menu commands to a panel.  Thanks!


WSH Panel Mod

Reply #759
@Hitchhiker427:
I recommend you to construct a menu that contains these commands by yourself, it could have supported technically though.

WSH Panel Mod

Reply #760
Oh well.  Is there a way to grab a list of all the playlist names?  The "switch to playlist" submenu automatically lists all playlists, but I'm not sure how I could go about programming this with the currently available WSH Panel commands.  Thanks.

WSH Panel Mod

Reply #761
When I try to use Br3tt's Xchange 3.6.0 with Foobar 1.0, I get this kind of script errors.

=====================
WSH Panel Mod (GUID: FE555B68-9973-4106-9569-0F56AA7E707A): initliased in 0.0000424 s
Error: WSH Panel Mod (GUID: FE555B68-9973-4106-9569-0F56AA7E707A): Microsoft JScript Runtime Error:
Object is needed.
Ln: 98, Col: 3
<source text only available in compile time>
WSH Panel Mod (GUID: D8C107F3-CD87-47B0-9268-B2A93F21DD6F): initliased in 0.0000104 s
WSH Panel Mod (GUID: 67DCFFEA-F20F-4925-B950-99FE234D6628): initliased in 0.0000034 s
Filter Panel - Genre: initialised in 0.001 s
Filter Panel - Artist: initialised in 0.001 s
Filter Panel - Album: initialised in 0.001 s
WSH Panel Mod (GUID: A4CEED06-F3D8-4464-AE8D-F2AC641A7484): initliased in 0.0000124 s
Error: WSH Panel Mod (GUID: A4CEED06-F3D8-4464-AE8D-F2AC641A7484): Microsoft JScript Runtime Error:
Object is needed.
Ln: 61, Col: 4
<source text only available in compile time>
WSH Panel Mod (GUID: 9C80188A-367D-436B-86C9-F40D8BFBE4B7): initliased in 0.0000108 s
Error: WSH Panel Mod (GUID: 9C80188A-367D-436B-86C9-F40D8BFBE4B7): Microsoft JScript Runtime Error:
Object is needed.
Ln: 62, Col: 13
<source text only available in compile time>
WSH Panel Mod (GUID: 305E4E48-FAA0-4D8C-9992-64751C8364C2): initliased in 0.0000078 s
WSH Panel Mod (GUID: 6DE51533-8626-4A22-827A-C4A5C7D89249): initliased in 0.0000039 s
WSH Panel Mod (GUID: CFD19F51-0140-444F-BA25-096381C4D8E1): initliased in 0.0000048 s
WSH Panel Mod (GUID: 56DF1127-3F17-4DD0-9A1C-28E68A692096): initliased in 0.0000057 s
WSH Panel Mod (GUID: F430759F-4E5C-4E96-8ADB-8F76B82AC9C2): initliased in 0.0000017 s
Error: WSH Panel Mod (GUID: F430759F-4E5C-4E96-8ADB-8F76B82AC9C2): Microsoft JScript Runtime Error:
Object is needed.
Ln: 19, Col: 3
<source text only available in compile time>
WSH Panel Mod (GUID: 883C9342-A015-4930-ACA9-E6C01E062750): initliased in 0.0000042 s
WSH Panel Mod (GUID: 31C5D6E8-BAAA-4926-A524-462B0335E901): initliased in 0.0000069 s
Error: WSH Panel Mod (GUID: CFD19F51-0140-444F-BA25-096381C4D8E1): Microsoft JScript Runtime Error:
Procedure call or argument is not valid.
Ln: 290, Col: 3
<source text only available in compile time>
Error: WSH Panel Mod (GUID: 305E4E48-FAA0-4D8C-9992-64751C8364C2): Microsoft JScript Runtime Error:
Procedure call or argument is not valid.
Ln: 64, Col: 1
<source text only available in compile time>
Startup time : 0:02.943336
========================================

There was no problem with the previous WSH panel mod 1.2.1 and Xchange 3.5.2 with Foobar 0.9.6.9 under Windows XP sp3.

Could anyone help me?

WSH Panel Mod

Reply #762
@Hitchhiker427:
I may add some API to access them in the future.

@widerock:
This is not related to WSH Panel Mod it self, if you are already using the latest version.
BTW, from what the error location is, I assume that you don't have xhange files correctly installed.


WSH Panel Mod

Reply #763
@widerock:
This is not related to WSH Panel Mod it self, if you are already using the latest version.
BTW, from what the error location is, I assume that you don't have xhange files correctly installed.

Wow.. it's my mistake. I installed xchange in the wrong directory.
Thank you very much, T.P Wang.


WSH Panel Mod

Reply #765
WSH Panel 1.3.2 Beta 3 Uploaded:
Changelog delta:
Code: [Select]
- ADD: on_playlists_changed() callback.
- ADD: Properties fb.PlaylistCount, fb.ActivePlaylist and fb.PlayingPlaylist.
- ADD: Methods fb.GetPlaylistName(), fb.CreatePlaylist(), fb.RemovePlaylist(), fb.MovePlaylist() and fb.RenamePlaylist().
- ADD: Sample Themed Progress Bar.txt.
- FIX: Preserve current selection when panel get focus.

WSH Panel Mod

Reply #766
progressbar is very sweet
can this component make somehow possible two instances in CUI toolbar, or is that CUI toolbar limitation?

WSH Panel Mod

Reply #767
WSH Panel 1.3.2 Beta 3 Uploaded:
Changelog delta:
Code: [Select]
- ADD: on_playlists_changed() callback.
- ADD: Properties fb.PlaylistCount, fb.ActivePlaylist and fb.PlayingPlaylist.
- ADD: Methods fb.GetPlaylistName(), fb.CreatePlaylist(), fb.RemovePlaylist(), fb.MovePlaylist() and fb.RenamePlaylist().
- ADD: Sample Themed Progress Bar.txt.
- FIX: Preserve current selection when panel get focus.


WoW, playlist Methods, very sweet

thank you!

WSH Panel Mod

Reply #768
Thank you!

WSH Panel Mod

Reply #769
Excuse me for my ignorance but the included box blur example throws the error everytime you restart foobar.

Error: WSH Panel Mod (GUID: 031CFC6C-B509-4E8B-9BA7-9825AFB21B4E): Microsoft JScript runtime error:
'img_to_blur' is null or not an object
Ln: 88, Col: 2
<source text only available in compile time>

Can somebody tell me how can i fix this?






I'm trying to learn everyday little bit, but it's soooo hard 

WSH Panel Mod

Reply #770
edit: ignore. i was thinking of a different sample. 

WSH Panel Mod

Reply #771
@ExtremeHunter:
In callback on_size(), check window.Width and window.Height:
Code: [Select]
ww = window.Width;
hh = window.Height;

// Add this line
if (ww <= 0 || hh <= 0) return;


FYI: If you want to create glow/blur text, consider using IStyleTextRender interface instead.

WSH Panel Mod

Reply #772
Thanks T.P that fixed it 

WSH Panel Mod

Reply #773
Sorry, but I'm having trouble switching the active playlist.  For some reason, the "View > Switch to playlist > [playlist name]" commands do not work.  Would it be possible to add a fb.SwitchPlaylist() command?  Thanks.

WSH Panel Mod

Reply #774
^fb.ActivePlaylist = id;