Skip to main content

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

0 Members and 2 Guests are viewing this topic.
  • D.Sync
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1725
I am not really familiar with WSH coding but I was wondering whether someone could solve the delay problem in marc playcount script? The delay is when a track is submitted for loved/unloved.

  • rawny
  • [*]
WSH Panel Mod script discussion/help
Reply #1726
Got it working!


Glad to hear it 

Without seeing all of your code I can't tell for sure. Off the top of my head, the only explanation I can think of is that i is defined somewhere else (perhaps globally) and this is interfering with the loop. Beyond that...no idea...
  • Last Edit: 07 June, 2012, 12:08:00 PM by rawny

  • r0k
  • [*][*]
WSH Panel Mod script discussion/help
Reply #1727
... I was wondering whether someone could solve the delay problem in marc playcount script? ...

Well, delays tend to occur when the computer is busy doing something, so apart from removing some actions, i don't think it's possible.
Now, i don't find this particular script. Maybe he released a new version of his samples after i downloaded them.
Without seeing all of your code I can't tell for sure. Off the top of my head, the only explanation I can think of is that i is defined somewhere else (perhaps globally) and this is interfering with the loop. Beyond that...no idea...

Ha, i'm such a noob 
I don't use variables such as "i" globally of course, only for loops ...
But this loop was nested inside another loop ... using i as a counter of course.
I was actually resetting i in the middle of the outer loop, causing it to become endless. And i was trying to find why the inner loop was endless

  • rawny
  • [*]
WSH Panel Mod script discussion/help
Reply #1728
Ha, i'm such a noob 
I don't use variables such as "i" globally of course, only for loops ...
But this loop was nested inside another loop ... using i as a counter of course.
I was actually resetting i in the middle of the outer loop, causing it to become endless. And i was trying to find why the inner loop was endless


Haha, I've been there before! 
It's sometimes more useful to use meaningful names for loop counters, just so when you get to the inner-loop you make sure you're using innerLoopIndex and not outerLoopIndex (although to be fair I only tend to do this when I'm coding something semi-serious, I should probably do it more often  ).

Glad you got it all figured out

  • r0k
  • [*][*]
WSH Panel Mod script discussion/help
Reply #1729
I had the first (outer) loop coded several days ago, but only yesterday i decided to add statements to gather informations about my track groups. I totally forgot about the first loop.
What i should have done is code the comparator as an external function and take benefit of local variables.
Speaking of local variables, it's probably obvious for some people, but in case it's not, i made a test.
Code: [Select]
// ==PREPROCESSOR==                 -->    CONSOLE OUTPUT
// @name "test"                          
// ==/PREPROCESSOR==                     
                                        
var toto = "toto is Global";             
fb.trace("L6 "+toto);               -->    L6 toto is Global
                                        
function test() {                        
    var toto = "toto is Local";          
    fb.trace("L10 "+toto);          -->    L10 toto is Local
}                                        
                                        
function test2() {                       
    toto = "Heavy Metal never dies";     
    fb.trace("L15 "+toto);          -->    L15 Heavy Metal never dies
}                                        
                                        
test();                                  
fb.trace("L19 "+toto);              -->    L19 toto is Global
                                        
test2();                                 
fb.trace("L22 "+toto);              -->    L22 Heavy Metal never dies

If a local variable is defined inside a function using var statement, even if a global variable has the same name, the global will not be overwritten. However, if var is omitted, the global will be overwritten.
Furthemore, if a local variable is defined with var, then the variable is changed to another value, like in this second test
Code: [Select]
// ==PREPROCESSOR==                 -->    CONSOLE OUTPUT
// @name "test"                         
// ==/PREPROCESSOR==                    
                                        
var toto = "toto is Global";            
fb.trace("L6 "+toto);               -->    L6 toto is Global
                                        
function test() {                       
    var toto = "toto is Local";         
    fb.trace("L10 "+toto);          -->    L10 toto is Local
    toto = "Heavy Metal never dies";    
    fb.trace("L12 "+toto);          -->    L12 Heavy Metal never dies
}                                       
                                        
test();                                 
fb.trace("L16 "+toto);              -->    L16 toto is Global

The change will affect the local variable, and not the global one.
That's a good reason to get used to always use var

WSH Panel Mod script discussion/help
Reply #1730
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.


That was exactly what  I was looking for. Thank you
Decalicatan Decalicatan

  • MordredKLB
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1731
Is there anyway to hide the mouse cursor using WSH Panel? I'd love to be able to add a timeout in on_mouse_move to hide it after a few seconds of inactivity in my HTPC script.

  • MordredKLB
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1732
Even if there is a way to do this, I'm not sure it's possible because I get continuous on_mouse_move events whether the mouse is moving or not. Is this the way it's supposed to be, because it seems like a bug. I verified that it wasn't weirdness with my mouse by turning off my mouse and not touching the trackpad on my laptop.
  • Last Edit: 10 June, 2012, 03:45:48 PM by MordredKLB

  • r0k
  • [*][*]
WSH Panel Mod script discussion/help
Reply #1733
I can confirm on_mouse_move seems to trigger continually as long as the mouse is in the WSH panel area.
One way to work around this would be to store prevMouseXand prevMouseY in some variable/object and make a conditional check in on_mouse_move
Code: [Select]
 if (prevMouseX != x || prevMouseY != Y)

to know whether the mouse is actually moving or not.
Here is some working code you can use if you can find a way to actually hide the cursor. I tried window.SetCursor(...); but there is no "hidden" option.
Code: [Select]
var prevMouseX = 0;
var prevMouseY = 0;
var mouseActive = true;

function hideCursor() {
    if (mouseActive) return;
    // Add some code to hide the mouse
}

function on_mouse_move(x, y) {
     if (prevMouseX != x || prevMouseY != y) {
         prevMouseX = x;
         prevMouseY = y;
         mouseActive = true;
         // Add some code to show the mouse
     } else {
         mouseActive = false;
         window.SetTimeout(function () {hideCursor();},1000);
     }
}

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1734
you can use a negative number to hide it.

Code: [Select]
window.SetCursor(-1);

  • r0k
  • [*][*]
WSH Panel Mod script discussion/help
Reply #1735
Thanks for the tip marc2003  It's much simpler than i would have imagined.

Well, while i'm here i could as well ask something. Is there a simple way of preventing on_mouse_lbtn_up() from trigerring it's effect when you double-click. Currently, if i double click, it will trigger on_mouse_lbtn_up twice and on_mouse_lbtn_dblclk once. That's logical but not very practical.
I guess know i can call a delayed function in on_mouse_lbtn_up with a conditional check that would evaluate to false if on_mouse_lbtn_dblclk have been triggered but maybe there is something easier.
EDIT : Tested the delay, it works. Still willing to learn possible alternatives
  • Last Edit: 11 June, 2012, 12:47:41 PM by r0k

  • MordredKLB
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1736
Thanks for the suggestions r0k and marc. I've got it working perfectly now. Here's my final code if anyone is interested:
Code: [Select]
var state["mouse_x"] = 0;
var state["mouse_y"] = 0;
var hideCursor = 0;

function on_mouse_move(x, y) {
    if (x != state["mouse_x"] || y != state["mouse_y"]) {
        window.SetCursor(32512);    // arrow
        state["mouse_x"] = x;
        state["mouse_y"] = y;
        window.ClearTimeout(hideCursor);
        hideCursor = window.SetTimeout(function() {
            window.SetCursor(-1);    // hide cursor
            }, 5000);
    }
}

That's how I'd handle a on_mouse_lbtn_up if forced to differentiate. I can't think of any other way right now.
  • Last Edit: 11 June, 2012, 01:43:34 PM by MordredKLB

  • romka18
  • [*]
WSH Panel Mod script discussion/help
Reply #1737
after WSH VU meter appears im interested in other activex objects i can add to my wsh panel. i know about shell object, vbcontrol (but dont know how to use it), httpdocument, filesystem. and now its vumeter. is anybody knows any interesting object? as i remember, marc2003 posted somewhere script showing your soundcard name. can anybody writes something about it or show me where i can read abou that?

WSH Panel Mod script discussion/help
Reply #1738
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.


  • romka18
  • [*]
WSH Panel Mod script discussion/help
Reply #1739
thanks, im also wanted for object to control file copy and transcoding audio by SOX otherwise shell. it will be nice if i get progress of each file.
now im using autoitx3 to control window size without standart windows borders, but in same way. and near aims - transcoding and file copy operations

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

musicbrainz releases: entries with no date now appear at end of list instead of the beginning

  • Ryoma
  • [*]
WSH Panel Mod script discussion/help
Reply #1741
I just tried some samples by pasting and replacing the content in my WSH Panel (coverflow) already pretty working but I get this:

||Scripting Engine Initialization Failed (Playback Buttons by marc2003, CODE: 0x80020101)
Check the console for more information (Always caused by unexcepted script error).||

  • mjm716
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1742
thank you


Also big props Falstaff - your scripting has really made my layout appealing. But now the annoying request.

Is there any way to get the playlist to collapse the album views, so tracks could be displayed or not via click (e.g. on heading/arrow/icon to expand/contract) and bonus points if the now playing album automatically expands.

I'm essentially searching for something similar to ELplaylist that works in DUI.

For example, this direction is great: http://www.hydrogenaudio.org/forums/index....st&p=799256

Artist overview (& album count) with chronologically listed albums, that then would expand to display track listings on click.

Dare to dream I know, but any tips towards this direction (in DUI) would be much appreciated.

thanks,

.Mike
  • Last Edit: 17 June, 2012, 06:47:03 AM by mjm716

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

musicbrainz releases: entries with no date now appear at end of list instead of the beginning

Nice it's always those little things!

I hope you don't mind, but I added buttons for discogs & allmusic to your 'web links' (if it suits you, feel free to redistribute in your ZIP)

button preview: http://desmond.imageshack.us/Himg195/scale...amp;res=landing

New discogs+allmusic buttons here: http://www.mediafire.com/?kaywlua6nrtritl

also note, the MySpace link has been updated to function correctly

Code: [Select]
// ==PREPROCESSOR==
// @import "%fb2k_profile_path%marc2003\common4.js"
// @import "%fb2k_profile_path%marc2003\tooltip_buttons.js"
// @name "Web Links"
// @author "marc2003"
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

var bw = 32;
var bh = 32;
var left_margin = 0;
var top_margin = 0;

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var script_name = "Web Links";
var custom_background = window.GetProperty("custom_background", "");
var bg = window.GetProperty("bg", 102);
selection_mode = 1;

on_item_focus_change();

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

function on_paint(gr) {
buttons_background(gr);
buttonsDraw(gr);
}

function on_playback_new_track() {
on_item_focus_change();
}

function on_metadb_changed() {
if (!g_metadb) return;
var myspace = fb.TitleFormat("http://www.myspace.com/search/music?q=$replace(%artist%, ,)").EvalWithMetadb(g_metadb);
var lastfm = fb.TitleFormat("http://www.last.fm/music/$replace(%artist%, ,+,/,'%'252F,?,'%'3F)/_/$replace(%title%, ,+,/,'%'252F,?,'%'3F)").EvalWithMetadb(g_metadb);
var youtube = fb.TitleFormat("http://www.youtube.com/results?search_query=$replace(%artist%+%title%, ,+,'(',,')',,/,+,&,and)").EvalWithMetadb(g_metadb);
var discogs = fb.TitleFormat("http://www.discogs.com/search?q=$replace(%artist%, ,+,'(',,')',,/,+,&,and)").EvalWithMetadb(g_metadb);
var allmusic = fb.TitleFormat("http://allmusic.com/search/artist/$replace(%artist%, ,+,'(',,')',,/,+,&,and)").EvalWithMetadb(g_metadb);
Buttons = {
but1: new Button(left_margin, top_margin, bw, bh, {normal: images_path + "myspace.png", hover: images_path + "myspace_h.png"}, function() { WshShell.run(myspace); }, myspace),
but2: new Button(left_margin + bw, top_margin, bw, bh, {normal: images_path + "lastfm.png", hover: images_path + "lastfm_h.png"}, function() { WshShell.run(lastfm); }, lastfm),
but3: new Button(left_margin + (bw * 2), top_margin, bw, bh, {normal: images_path + "youtube.png", hover: images_path + "youtube_h.png"}, function() { WshShell.run(youtube); }, youtube),
but4: new Button(left_margin + (bw * 3), top_margin, bw, bh, {normal: images_path + "discogs.png", hover: images_path + "discogs_h.png"}, function() { WshShell.run(discogs); }, discogs),
but5: new Button(left_margin + (bw * 4), top_margin, bw, bh, {normal: images_path + "allmusic.png", hover: images_path + "allmusic_h.png"}, function() { WshShell.run(allmusic); }, allmusic)
}
window.Repaint();
}

function on_mouse_move(x, y) {
buttonsMove(x, y);
}

function on_mouse_lbtn_up(x, y) {
buttonsUp(x, y);
}

function on_mouse_leave() {
buttonsLeave();
}

function on_mouse_rbtn_up(x, y) {
background_menu(x, y);
return true;
}
  • Last Edit: 17 June, 2012, 08:10:19 AM by mjm716

  • D.Sync
  • [*][*][*]
WSH Panel Mod script discussion/help
Reply #1744
From one of the WSH script (from musickarte skin), the following error is displayed when I updated my WSH panel mod to the latest version 1.5.2.

Error:
Code: [Select]
JScript runtime error:
Object doesn't support this property or method


WSH error line:
Code: [Select]
var hWnd       = utils.GetHWND("{E7076D1C-A7BF-4f39-B771-BCBE88F2A2A8});


It seemed that the method utils.GetHWND no longer exist in the latest version. I have no knowledge about WSH scripting and thus would need help on this issue. This issue had kept me from updating my previous WSH version (1.4.9) to the latest version

  • Falstaff
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1745
@D.Sync

official WSH Panel Mod had never used this method. It belongs to a modified version of WSH Panel Mod stuck in v1.4.x, support seems totally discontinued... to forget.

  • trout
  • [*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1746
I want to have a volume control that only shows when the mouse cursor is over it. I've searched for any mouse-over examples so I could modify T.P Wang's volbar code example, but haven't found anything. I know next to nothing about coding, and my attempts to find javascript documentation and learn how to do this on my own have not gone well. So I'm hoping someone can point me to an example I can work from, or show how it's done.

Thanks!
  • Last Edit: 18 June, 2012, 10:12:48 AM by trout

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1747
@mjm716, thanks for those images. i've bundled them in and cleaned up the script a bit.

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

@Ryoma, you should read the error you posted.....

Quote
Check the console for more information


@trout, i don't have time now but if someone else doesn't answer before tomorrow, i might be able to knock something up for you.
  • Last Edit: 18 June, 2012, 10:43:44 AM by marc2003

  • Ryoma
  • [*]
WSH Panel Mod script discussion/help
Reply #1748
@Ryoma, you should read the error you posted.....


Don't mind.
My mistake.

  • marc2003
  • [*][*][*][*][*]
WSH Panel Mod script discussion/help
Reply #1749
  • Last Edit: 19 June, 2012, 10:20:36 AM by marc2003