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: JScript Panel (Read 110952 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Status Bar sample script bug

Reply #75
Hello,

I tried using the mouse scroll wheel to change the volume while playing with the Status Bar sample. The script lowers the volume when rolling the wheel both backward and forward. Using foobar's volume control in the notification area works as expected. I don't see an obvious error in the script, which is probably the only kind I can find right now given my current meager knowledge of JavaScript.

As an aside, I decided to install JScript Panel because of included Seekbar script sample; I hoped it might solve my problem with the foobar seekbar, which is that it's practically invisible from across the room. I'm happy to say that I successfully modified the script to create exactly what I needed. Many thanks, @marc2003, for making this possible.

Mark

Re: Status Bar sample script bug

Reply #76
I tried using the mouse scroll wheel to change the volume while playing with the Status Bar sample. The script lowers the volume when rolling the wheel both backward and forward.
I modified the Status Bar example to fill other needs. Setting the volume via the mouse wheel is still not working properly, but I'm keeping that functionality because I'll like it a lot when it works. (Or I might try adding another panel with the Volume sample script instead. You never know.)

The function involved is:
Code: [Select]
function on_mouse_wheel(s) {
if (!show_volume)
return;
if (s == 1)
fb.VolumeUp();
else
fb.VolumeDown();
I set the var s to 0, which reversed the effect, i.e., the volume only rises. I tried -1 and recreated the original behavior. I found Volume entries in interfaces.txt but haven't a clue at this time what to do with the information.

I'm running foobar on Windows 7 Home Premium and using the DUI.

Recently played items list

Reply #77
I've used two JScript panels to replace five Text Display panels, added panels using the playback buttons and seekbar sample scripts, and got the status bar panel I've been referring to above configured to my liking. (The Status Bar playlist track count has already become very useful.) I really like this thing!  ;D

I sometimes hear a song I like (or not), but don't know what it is and can't drop what I'm doing to check before the track ends. When I was using Zune (gack) I could simply go back to the previous track or two to find out what I was listening to. However, foobar doesn't work that way. That may be the only advantage Zune has over fb2k.

While hacking away at the sample scripts I'm using, I got to thinking it might well be possible to create a list of recently-played tracks in JScript Panel. Am I correct? Would it be difficult? (For me, probably yes, even if it's a relatively simple thing. I have much to learn.)

Re: JScript Panel

Reply #78
Can you try and see if this works...

Code: [Select]
function on_mouse_wheel(a, b) {
if (!show_volume)
return;
if (b > 0)
fb.VolumeUp();
else
fb.VolumeDown();
}

As for getting a list of recently played tracks, install foo_playcount. Then after playing some tracks, you can use the Library menu>Playback Statistics>Show recently played.

Re: JScript Panel

Reply #79
Can you try and see if this works...
[snip]
As for getting a list of recently played tracks, install foo_playcount. Then after playing some tracks, you can use the Library menu>Playback Statistics>Show recently played.

That works a treat!

I'll check out foo_playcount. I'm still curious, though, if you think it's possible to display a dynamic recently-played list using JScript Panel.

Thank you.

Re: JScript Panel

Reply #80
Code: [Select]
v1.1.2
- FIX: Fix on_mouse_wheel not being called with certain trackpads.

https://github.com/19379/foo-jscript-panel/releases

@Jailhouse, this should fix the volume problem you were having. Reverting back to the original script should work.

As for tracking plays with Jscript Panel, of course it's possible. I just don't think it's worth the effort when foo_playcount does it as well.

Re: JScript Panel

Reply #81
Code: [Select]
v1.1.2
- FIX: Fix on_mouse_wheel not being called with certain trackpads.

https://github.com/19379/foo-jscript-panel/releases

@Jailhouse, this should fix the volume problem you were having. Reverting back to the original script should work.

The original script works fine now. Thanks.

Quote
As for tracking plays with Jscript Panel, of course it's possible. I just don't think it's worth the effort when foo_playcount does it as well.

I see your point, but there are other dynamics here: I would like to see the list at a glance; I don't want to install any more components than I have to, and I already have JScript Panel; most important, working toward a goal of my choosing will help me to learn and understand more quickly as I'll be more interested in the result.

Odd behavior in DUI playlist apparently due to JScript Panel

Reply #82
While working with some of the sample scripts for JScript Panel (JSP), I noticed that when playing tracks in random order the track being played was shown at either the top of the DUI playlist window or at the bottom, depending on its location in the list relative to the previous track. Normally, the current track is displayed in the middle of the window where it's easy to find; a nice touch.

I suspected JSP might have had something to do with this since it's the only third-party component I'm using. I have subsequently found that if I remove all the panels and restart foobar, the playlist window updates normally. If I then restore the panels, the window still updates as it should until I restart foobar, upon which the misbehavior returns. I do not have to interact with the panels in any way, including moving the cursor over them, for this to happen.

I am using the following scripts, in order of installation:
  • seekbar
  • now playing (basic)
  • status bar
  • playback buttons

I first noticed the problem as I was working on the second script, but I can't say for certain that it wasn't happening from the time I was working on seekbar. I have modified the first three scripts to remove the bits I didn't need and change formatting. I've been careful, but I'm open to the possibility that I may have inadvertently become a troublemaker.

It just occurred to me that I did not test removing panels individually. I'll be happy to do so upon request.

Re: JScript Panel

Reply #83
I have been able to reproduce that but not reliably. Re-arranging panels can make it work again and then it stops again - all without restarting foobar.

Also, the following playlist views are unaffected so I feel there is nothing I can do about this.

EsPlaylist (default UI and columns UI)
SimPlaylist (default UI)
NGplaylist (columns UI)
JSplaylist (WSH panel mod script by Falstaff modded by me for JScript panel)

Even if other playlist views were affected, I still don't think I could do anything about it because I wouldn't know where to begin trying to debug it.

Re: JScript Panel

Reply #84
I had one instance where I booted my PC and when I started foobar the playlist functioned normally, but the problem returned upon the next foobar start. Other than that, starting foobar with any panels installed triggers the issue, and starting with no panels solves it.

Even if other playlist views were affected, I still don't think I could do anything about it because I wouldn't know where to begin trying to debug it.
I imagine this problem would be easier to debug if it would throw an error or cause foobar to crash. I'm hoping you're like me and you suddenly come up with a possible solution out of the blue. I seem to do my best thinking subconsciously.

I also imagine that with this being a cosmetic issue that doesn't affect the playlist's functionality and isn't a bug in foobar, Peter isn't likely to be very interested in looking into it and so calling attention to it in the Support forum probably wouldn't be useful.

Since you mentioned JSplaylist, I think I'll look into that. It seems that in time my entire foobar GUI will be composed of JScript panels.

Re: JScript Panel

Reply #85
Hi, I want to add a new colum to the playlist (LRC-TXT-N/A) to show if there is a .lrc file or a .txt file or neither in the same directory of the .mp3 file. I think will be useful to know wich songs have timed lyrics, wich don't. You know you should want to keep  singing all day long. I try to do that with the title formating options but ... . It is that possible with Jscript?

Re: JScript Panel

Reply #86
Yes, it's possible. Next you'll be asking how...  :P

Re: JScript Panel

Reply #87
Hi,

A user of this forum ask me if i was willing to use in one of my script a function available in a wsh panel mod made by a Russian guy, which allow to save a GdiImage to the disk, as jpg, bmp, png, gif, or tiff
It's great to make a cover cache, and the code source of his mod is available online, i tried and it seems to work quite well, he added a SaveAs method (like the Resize() method for example) to the IGdiBitmap object.
@Marc2003, are you willing to add it to your jscript component ? It should be just a copy/pastle game, by searching the SaveAs reference in the provided files.

The code source of his component is here : https://github.com/ttsping/foo_uie_wsh_panel_mod_plus
And if you want to browse only the files containing the SaveAs method, there is only 3 files, and they are here http://www.mediafire.com/download/9gzlozp4lt27pzg/script_interface_impl_with_SaveAs.zip

Maybe there is others good new functions in his component, but i didn't really browse the repository, and the component may be buggy (i don't know), so it's probably a bad idea to copy everything.

And the doc of this method is here :

      SaveAs(path, [format = "image/png"]); (Boolean)
      // format:
      // default - "image/png",
      // supported - "image/bmp"
      //     "image/jpeg"
      //     "image/gif"
      //        "image/tiff"
      //  e.g.: var img = gdi.CreateImage(1, 1);
      // img.SaveAs("D:\\img.png","image/png");   

Re: JScript Panel

Reply #88
I'm pretty sure he's Chinese, not Russian. Just look at the github commits he's made in the last 2 days. Anyway, I will consider adding this in the next day or so..

Re: JScript Panel

Reply #89
Oh yes, possible, i don't even remember why i though he was russian, i'm pretty sure he is a human, and one who know how to write a c++ function, that's all i'm sure about : )

Re: JScript Panel

Reply #90
Remember that on_mouse_wheel issue you had and you provided me with some extra code so it returns 3 arguments. I've since updated the first argument so can you test and see if it works for you. If so, I can then tidy up by removing the other two.

Re: JScript Panel

Reply #91
Nope, it doesn't fix it, if i remove the second and third argument, it scroll, but way too quickly.
My trackpad trigger on_mouse_wheel events repeatedly with small values, and step is an integer, 1 or -1, so one scroll with my trackpad make something like ten calls to on_mouse_wheel, with step equal to 1 or -1

Re: JScript Panel

Reply #92
Fairy nuff. I'll leave it in.

Re: JScript Panel

Reply #93
Hi,

A user of this forum ask me if i was willing to use in one of my script a function available in a wsh panel mod made by a Russian guy, which allow to save a GdiImage to the disk, as jpg, bmp, png, gif, or tiff
It's great to make a cover cache, and the code source of his mod is available online, i tried and it seems to work quite well, he added a SaveAs method (like the Resize() method for example) to the IGdiBitmap object.
@Marc2003, are you willing to add it to your jscript component ? It should be just a copy/pastle game, by searching the SaveAs reference in the provided files.

The code source of his component is here : https://github.com/ttsping/foo_uie_wsh_panel_mod_plus
And if you want to browse only the files containing the SaveAs method, there is only 3 files, and they are here http://www.mediafire.com/download/9gzlozp4lt27pzg/script_interface_impl_with_SaveAs.zip

Maybe there is others good new functions in his component, but i didn't really browse the repository, and the component may be buggy (i don't know), so it's probably a bad idea to copy everything.

And the doc of this method is here :

      SaveAs(path, [format = "image/png"]); (Boolean)
      // format:
      // default - "image/png",
      // supported - "image/bmp"
      //     "image/jpeg"
      //     "image/gif"
      //        "image/tiff"
      //  e.g.: var img = gdi.CreateImage(1, 1);
      // img.SaveAs("D:\\img.png","image/png");   

Maybe you mean ttsping's WSH Panel Mod Plus, but he is not a 'Russion' guy...

and his component is not buggy at all, because we've used&tested  it for a long time and it works well. ttsping decided to extend wsh_panel_mod 1.5.6 after wang t.p. did not appear in public for years.(It's a tradition in China that people like to do some interesting things in their school days and disappear after they find a job)

ttsping had released a public version of wsh_panel_mod_plus in github days ago which you may have already know.
A rose will bloom, it then will fade.

Re: JScript Panel

Reply #94
Code: [Select]
v1.1.3
- ADD: IGdiBitmap SaveAs method.

https://github.com/19379/foo-jscript-panel/releases

My version of the docs:

Code: [Select]
		SaveAs(path, [format]); (boolean)
/*
path: full path including file extension. the parent folder must already exist.
format:
"image/png" (default if omitted)
"image/bmp"
"image/jpeg"
"image/gif"
"image/tiff"

example:
var img = utils.GetAlbumArtEmbedded(fb.GetFocusItem().RawPath, 0);
if (img)
img.SaveAs("D:\\export.jpg", "image/jpeg");
*/

Re: JScript Panel

Reply #95
Thanks a lot, i build a cache system for my layout using it, it work perfectly, and now foobar is a quite a lot faster, it's much faster to load an already resized image directly instead of using the GetAlbumArt functions

Re: JScript Panel

Reply #96
Reply #85 – 14 February, 2016, 01:33:15 PM
Hi, I want to add a new colum to the playlist (LRC-TXT-N/A) to show if there is a .lrc file or a .txt file or neither in the same directory of the .mp3 file. I think will be useful to know wich songs have timed lyrics, wich don't. You know you should want to keep  singing all day long. I try to do that with the title formating options but ... . It is that possible with Jscript?


Reply #86 – 14 February, 2016, 04:05:50 PM
Yes, it's possible. Next you'll be asking how...  :P


Not really I worked a litlle around and I doit in this way:

if ( this.metadb.path.indexOf(".mp3")){
  texto = this.metadb.path.replace(".mp3",".lrc");
}
  if (utils.ReadTextFile(texto) ) {
gr.GdiDrawText("LRC", gdi.Font("tahoma", 11), isplaying?g_textcolor_sel:g_textcolor, columns.title_x, this.y, columns.title_w, this.h-row.parity, DT_LEFT | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
} else {
gr.GdiDrawText(this.title, gdi.Font("tahoma", 11), isplaying?g_textcolor_sel:g_textcolor, columns.title_x, this.y, columns.title_w, this.h-row.parity, DT_LEFT | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
}

I insert this in your code at your old wsh script and works but I want it in your new Jscrip.... but I can't get it work...  why?
because this:

El objeto no acepta esta propiedad o método (The object doesn't accept the method o argument)
File: <main>
Line: 520, Col: 9
<source text only available at compile time>

and the line 520 is a // commente but the 521 is:

 521        fb.CreateAutoPlaylist(total, "Media Library", "ALL", "%album artist% | $if(%album%,%date%,'9999') | %album% | %discnumber% | %tracknumber% | %title%", 0);

I try to skip that line but later become other problems. What I doing bad?

Re: JScript Panel

Reply #97
Reply #85 – 14 February, 2016, 01:33:15 PM
Hi, I want to add a new colum to the playlist (LRC-TXT-N/A) to show if there is a .lrc file or a .txt file or neither in the same directory of the .mp3 file. I think will be useful to know wich songs have timed lyrics, wich don't. You know you should want to keep  singing all day long. I try to do that with the title formating options but ... . It is that possible with Jscript?


Reply #86 – 14 February, 2016, 04:05:50 PM
Yes, it's possible. Next you'll be asking how...  :P


Not really I worked a litlle around and I doit in this way:

if ( this.metadb.path.indexOf(".mp3")){
  texto = this.metadb.path.replace(".mp3",".lrc");
}
  if (utils.ReadTextFile(texto) ) {
gr.GdiDrawText("LRC", gdi.Font("tahoma", 11), isplaying?g_textcolor_sel:g_textcolor, columns.title_x, this.y, columns.title_w, this.h-row.parity, DT_LEFT | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
} else {
gr.GdiDrawText(this.title, gdi.Font("tahoma", 11), isplaying?g_textcolor_sel:g_textcolor, columns.title_x, this.y, columns.title_w, this.h-row.parity, DT_LEFT | DT_CALCRECT | DT_VCENTER | DT_END_ELLIPSIS | DT_NOPREFIX);
}

I insert this in your code at your old wsh script and works but I want it in your new Jscrip.... but I can't get it work...  why?
because this:

El objeto no acepta esta propiedad o método (The object doesn't accept the method o argument)
File: <main>
Line: 520, Col: 9
<source text only available at compile time>

and the line 520 is a // commente but the 521 is:

 521        fb.CreateAutoPlaylist(total, "Media Library", "ALL", "%album artist% | $if(%album%,%date%,'9999') | %album% | %discnumber% | %tracknumber% | %title%", 0);

I try to skip that line but later become other problems. What I doing bad?

If there is a better way to do it, I would like to Know of course!!!!

Re: JScript Panel

Reply #98
fb.CreateAutoPlaylist doesn't exist in JScript panel - it has been replaced with plman.CreateAutoPlaylist. Details of other changes here...

https://github.com/19379/foo-jscript-panel/wiki/Updating-WSH-Panel-Mod-scripts-for-JScript-Panel

An updated version of Br3tt/Falstaff's JSplaylist for JScript Panel can be found here..

https://github.com/19379/jsplaylist-mod

Updated version of JSSmoothPlaylist can be found here..

http://www.deviantart.com/art/JS-Smooth-Playlist-571375892

If you're not using either of these scripts then you will have to update it yourself.

Re: JScript Panel

Reply #99
how can i change the color of the themed seek bar?

 
SimplePortal 1.0.0 RC1 © 2008-2021