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 script discussion/help (Read 523843 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Re: JScript Panel script discussion/help

Reply #2075
last played 3?

Re: JScript Panel script discussion/help

Reply #2076
trying to format the date
this last Play: %$day_of_month(time)%%$month(timw)%%$year%(time)%$crlf()[/b]
returns this
Last Played: ???
Putting "last Play:" in as a text string cannot possible return "Last Played:".  You are not helping yourself by being so inaccurate with your quoting/transcribing.  You also seem to have ignored advice above exactly what titleformat strings to call.
It's your privilege to disagree, but that doesn't make you right and me wrong.

Re: JScript Panel script discussion/help

Reply #2077
It seems to be resolved
https://hydrogenaud.io/index.php/topic,127050.0.html
SHURE SRH1840, SENNHEISER HD660S2, SENNHEISER HD620S, SENNHEISER HD 490 Pro Plus, beyerdynamic DT 1990 PRO, HiFiMAN Edition XS, HIFIMAN ANANDA, Bowers & Wilkins P7, FiiO FT5, FiiO FT1 Pro, 水月雨 (MOONDROP) 空鳴 - VOID, SONY WH1000XM5 (made a Upgrade/Balanced Cable by myself)

Re: JScript Panel script discussion/help

Reply #2078
yes  :D


Re: JScript Panel script discussion/help

Reply #2080
Yes.  :))
SHURE SRH1840, SENNHEISER HD660S2, SENNHEISER HD620S, SENNHEISER HD 490 Pro Plus, beyerdynamic DT 1990 PRO, HiFiMAN Edition XS, HIFIMAN ANANDA, Bowers & Wilkins P7, FiiO FT5, FiiO FT1 Pro, 水月雨 (MOONDROP) 空鳴 - VOID, SONY WH1000XM5 (made a Upgrade/Balanced Cable by myself)

Re: JScript Panel script discussion/help

Reply #2081
glad you like it

Re: JScript Panel script discussion/help

Reply #2082
This confirms that you have been completely mocking people.
SHURE SRH1840, SENNHEISER HD660S2, SENNHEISER HD620S, SENNHEISER HD 490 Pro Plus, beyerdynamic DT 1990 PRO, HiFiMAN Edition XS, HIFIMAN ANANDA, Bowers & Wilkins P7, FiiO FT5, FiiO FT1 Pro, 水月雨 (MOONDROP) 空鳴 - VOID, SONY WH1000XM5 (made a Upgrade/Balanced Cable by myself)

Re: JScript Panel script discussion/help

Reply #2083
Text Display sample (or one of the derivatives):

My tags are %artistcountry% (and %releasecountry%).

How do I add the display of a country flag in the Custom text ... ?

Re: JScript Panel script discussion/help

Reply #2084
Text Display sample (or one of the derivatives):

My tags are %artistcountry% (and %releasecountry%).

How do I add the display of a country flag in the Custom text ... ?

Hi!
if it can help you
%artist% $font(Twemoji Mozilla,15) $country_flag(%country%)$crlf()


Re: JScript Panel script discussion/help

Reply #2086
I have a question about JS3 samples.

In a number of them you can select the "Selection mode" either Prefer now playing or Follow selected track.
It changes the value of panel.prefer_playing().

I like to change buttons based on this value the moment this value is changed.
What callback is associated with the change of this value so I can fire buttons.update() from within this callback?

Re: JScript Panel script discussion/help

Reply #2087
I have a question about JS3 samples.

In a number of them you can select the "Selection mode" either Prefer now playing or Follow selected track.
It changes the value of panel.prefer_playing().

I like to change buttons based on this value the moment this value is changed.
What callback is associated with the change of this value so I can fire buttons.update() from within this callback?
It works when I add one line in panel.js:
line 164   case idx == 110:
      case idx == 111:
         this.selection.value = idx - 110;
         this.item_focus_change();
         buttons.update();         // ADDED
         break;

But I prefer not to make changes to panel.js.

Re: JScript Panel script discussion/help

Reply #2088
Editing .js files was a terrible thing to do when the component was actively maintained. Any component update always wiped component folder contents as part of the process. But the component is no longer getting updated so do what you want.

Re: JScript Panel script discussion/help

Reply #2089
Editing .js files was a terrible thing to do when the component was actively maintained. Any component update always wiped component folder contents as part of the process. But the component is no longer getting updated so do what you want.
I never did update the js itself. I always took the code and included it in the sample file itself, before modding it. Only when you made major changes I had to redo this operation.

I guess there is no callback I can trigger upon changing the selection mode from the context menu, so I included the modified panel.js in the script.

BTW. You are sorrily missed and I hope at one time you actively start maintaining/updating the component again.

 

Re: JScript Panel script discussion/help

Reply #2090
For those interested ... I attached a package with updated Text Display script to facilitate current changes in foo_input_udsd. Also includes a list of changes.

Also did a RFC to the SACD/UDSD forum:
I attached two images of my current JS3 script that I adapted to represent current state of foo_input_udsd 0.015 and foo_outinfo 1.2.3.

Green part represents the current audio chain for the playing (selected or not selected) track (SACD in this case), I applied a silly DSP downmix to 1.0 to show things more clearly in the audiochain.
Blue depicts a debugger that show the currently in TF available fields. Tags are from the selected track and from the playing track (can be the same track of course).

First image: White are tags of the current selected playing/paused track (in this case an SACD track).
Second Image: Yellow are tags of the current selected not-playing track (normal flac in this case).

When an SACD track is selected and that track is playing, everything is ok.

What I'm missing in foo_input_udsd 0.015 when a SACD track is playing, but some other track (flac) selected are the following fields of the playing/not-selected SACD track that are required to see what happens in the audiochain:
1) $info(dsd_samplerate), $info(dsd_bitspersample), $info(dsd_channels)
2) $info(decoded_samplerate), $info(decoded_bitspersample), $info(decoded_channels)

I guess $info(decoded_channels) is not needed since foo_input_udsd probably does not change that while decoding, but I do need to see the number of channels before some DSP can mess around with it. So please also provide $info(dsd_channels).


Getting there slowly.

Re: JScript Panel script discussion/help

Reply #2091
I'm trying to make some button code that does not create a button when there is not enough width to show this button.

If a button has been created and the window is being resized to a smaller width than what this button needs, buttons.update() is fired and my buttoncode says not to (re)create this button. However the button still exists and  is displayed in weird places.
If the window width is enlarged and enough width becomes available again the button is restored to it's former glory.

What is the code to dispose of an existing not needed button?

NB. I have a workaround by recreating a dummy with the same name. But I'd rather have a more elegant solution.

I attached a slightly modified version of the Playback Buttons script. It contains 4 buttons and the last one is protected by the creation of a dummy button.

Re: JScript Panel script discussion/help

Reply #2092
Code: [Select]
buttons.update = function () {
    // this wipes all previous buttons
    this.buttons = {};

    // now create new ones conditionally
}

Re: JScript Panel script discussion/help

Reply #2093
I have a similar question about width with Text Display sample. I'm using it in "text only" mode, and basically I want to change the panel width to match the text width, i.e. something like -

Code: [Select]
var text_width = utils.CalcTextWidth2(text_layout, text_font);
window.MinWidth = window.MaxWidth = text_width;

The trouble being I have no clue how to access the text and font being used in the layout - is that easily possible?

I likewise made a workaround by duplicating the same title format and font size used and put that into new variables - and sure it works fine, but of course it would be nicer to get the existing width. If it would be more complicated than that, no need to bother, just my curiosity at play. ;)

I guess it could be complicated because the text can be on multiple lines and font sizes and how to determine which is the widest? - though I'm only using it to display a single tag value, such as $meta(artist,0)

Re: JScript Panel script discussion/help

Reply #2094
You can get the text/font like this.

Code: [Select]
var text_width = utils.CalcTextWidth2(text.text, panel.fonts.normal);


Re: JScript Panel script discussion/help

Reply #2095
^ Fantastic. That makes things so much easier. Thanks. 8)

Re: JScript Panel script discussion/help

Reply #2096
Code: [Select]
buttons.update = function () {
    // this wipes all previous buttons
    this.buttons = {};

    // now create new ones conditionally
}
Thx! That cleaned up the code a lot.

Re: JScript Panel script discussion/help

Reply #2097
New version

Attached screenshot shows all defined optional buttons.

Made some changes to get the audiocontrols of this script more in line with my AudioControls imagebuttons script.

Added OutputDev button
   Leftclick:      Dropdown to the available output devices
   Rightclick:      Reset to second device (Primary Sound Driver) or Preferences when Output Device is already second device
   Button char:   Different for Speakers, Headphones, Bluetooth and Otherwise
   Button colors:   Red for Null Device, Green [exclusive] devices, White for second device, Yellow for other Devices that are not Speakers, Headphones or Bluetooth

Added DSP Preset button
   Leftclick:      Dropdown to the available DSP Presets
   Rightclick:      Disable DSP or Preferences when DSP already disabled
   Button colors:   White if DSP is disabled, Red when downmix, Yellow when upmix, Green otherwise

Bugfix for NowPlaying button which led to not showing the correct artwork.

Preferences button is default OFF. Enable when desired.

PlayOrPause button now uses different chars for Not Playing, Playing and Paused.

Position of ReplayGain button is moved from last button on the left side to first on the right side.

Fixed on_size issues and improved aligning.
   Prioritize which selected buttons are shown when width is too limited. Change order when desired.
   Easy to adjust display positions for buttons. Change positions when desired.

Re: JScript Panel script discussion/help

Reply #2098
@Defender
Happy new year.
Thank you as always.

foobar2000 v2.24.1 64bit Default UI
2025-01-01 v14
Display: 3840 x 2160 27inch
 Line 198: var bs = _scale(30);

Use:
Flowin 0.2.2 (foo_flowin) It doesn't seem to affect the display.
JScript Panel 3 3.8.5 (foo_jscript_panel3)
Output Info 1.2.3 (foo_outinfo)
Playcount 2003 0.3.0 (foo_playcount_2003)
----
Button:
ReplayGain
DSP Preset
Output Device
Select Now Playing
-----
The buttons I see are different from your screenshots and description. Is this normal for my Text Display (2025-01-01 v14)?

SHURE SRH1840, SENNHEISER HD660S2, SENNHEISER HD620S, SENNHEISER HD 490 Pro Plus, beyerdynamic DT 1990 PRO, HiFiMAN Edition XS, HIFIMAN ANANDA, Bowers & Wilkins P7, FiiO FT5, FiiO FT1 Pro, 水月雨 (MOONDROP) 空鳴 - VOID, SONY WH1000XM5 (made a Upgrade/Balanced Cable by myself)

Re: JScript Panel script discussion/help

Reply #2099
Display: 3840 x 2160 27inch
 Line 198: var bs = _scale(30);

Use:
Flowin 0.2.2 (foo_flowin) It doesn't seem to affect the display.
JScript Panel 3 3.8.5 (foo_jscript_panel3)
Output Info 1.2.3 (foo_outinfo)
Playcount 2003 0.3.0 (foo_playcount_2003)

The buttons I see are different from your screenshots and description. Is this normal for my Text Display (2025-01-01 v14)?
Happy new year to you too.

This script is just a small adaptation I made on the original that is included with JS3 which missed a couple of things that I liked.
Until a week ago I did not even use the script myself, but now with changes being made and availability of components like foo_outinfo, foo_hdcd, foo_input_sacd/foo_input_udsd it offers me an extra value (especially the NowPlaying button and the Output text part) so I gave the script a panel in my skin.

I am a bit wary to offer support on this script and answer your question here in this thread though, since I don't want to fall in the same trap that happened with the VU meter script.
I'll answer your questions for now though and hope I don't piss off anyone.


About the buttons themselves:
What you are seeing is the way it is intended and the way I use the script myself. Out of the box these are the buttons that are enabled and the way they look and the colors also represent the way it is intended. The screenshot I sent accompanying the last version just has all buttons enabled.

In the config section of the script you can select what buttons are displayed. Line 63/70.

You have a different char for the ReplayGain, because your RG is set to Album mode, my setting and default is Track/Album by PBO, which gives the same result as Album when tracks are grouped by Album in the playlist (correct me if I'm wrong).

Your DSP button is a green star. I have chosen a star character to represent DSP after searching for something appropriate for a long time. If you have a better suggestion please do. I try to use only characters that in default mode only have an outline instead of a solid fill. It is green because you have a DSP enabled, of which the name not starts with Upmix or Downmix.

Your OutputDevice button is yellow, because it is not the default device (which is Primary Sound Driver). It would be green if you select your device in exclusive mode).
If I'm not mistaken in current versions of foobar you don't need to use WASAPI anymore since that is default behavior.
When you select an OutputDevice that start with Speakers the character the button uses will change.

About the plugins you are using:
The custom text part of script also supports foo_cover_utils (1.1), foo_hdcd (1.20+ preview 2024-12-22), and foo_input_udsd (0.0.15). Both foo_hdcd and foo_input_udsd need some work to be perfect, and I made detailed requests for that.

About the custom text you are using:
It is different from mine, but actually the only difference is the first played and last played fields. I will change the section of Custom Text to make the display for these two fields optional.


The change you have to make for ButtonSize is interesting. What scaling are you using? I use 100% on my main system and 250% on my 4K monitors and those do not need the value of the ButtonSize changed.
My knowledge of JS3 is very limited and I have no clue how to detect current windows scaling.

In TF I use this to detect correct scaling:
Code: [Select]
$font(Consolas,10,)														// Set fixed monospaced font
$puts(ts_consolas10,    $muldiv($gettextwidth($repeat(W,100)),100,700)) // Consolas 10 with scaling 100percent is 700 pixels

$ifgreater($get(ts_consolas10), 370, $puts(scale,350) ,
$ifgreater($get(ts_consolas10), 313, $puts(scale,300) ,
$ifgreater($get(ts_consolas10), 256, $puts(scale,250) ,
$ifgreater($get(ts_consolas10), 227, $puts(scale,225) ,
$ifgreater($get(ts_consolas10), 213, $puts(scale,200) ,
$ifgreater($get(ts_consolas10), 184, $puts(scale,175) ,
$ifgreater($get(ts_consolas10), 156, $puts(scale,150) ,
$ifgreater($get(ts_consolas10), 127, $puts(scale,125) ,
$puts(scale,100)
))))))))
Based on the scale value I set things like buttonsizes, bezels and accents which makes my skin look the same on all windows scalings, which is also the reason why I started making my own DarkOne skin in the first place.


For me the most valuable button in this script is the NowPlaying button, which offers me to switch with a rightlick between info for the current playing track and a different track in the playlist and also can change the focus (leftclick) in the playlist.
I use colors to distinguish between the playing and the selected track so you always know what you are looking at.

At the moment I don't have any things I would like to add to this script, but I am open for suggestions.

Can you send me a screenshot after you adapted your buttons, I'd like to see how you use this script?