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 303413 times) previous topic - next topic
0 Members and 3 Guests are viewing this topic.

Re: JScript Panel script discussion/help

Reply #1425
I removed all advanced queue management stuff in JSP3. It exists in JSP2 and SMP.

However, you can get queued items in a dirty way by using title formatting...

Code: [Select]
var tfo = fb.TitleFormat("[%queue_index%]");

function get_queued_items(playlistIndex) {
var items = plman.GetPlaylistItems(playlistIndex);
var queued_items = fb.CreateHandleList();

for (var i = 0; i < items.Count; i++) {
if (tfo.EvalPlaylistItem(playlistIndex, i).length) {
queued_items.AddItem(items.GetItem(i));
}
}

return queued_items;
}

var queued_items = get_queued_items(plman.ActivePlaylist);

As for playing a given item, use this...

https://jscript-panel.github.io/docs/namespaces/plman/#plmanexecuteplaylistdefaultactionplaylistindex-playlistitemindex

Re: JScript Panel script discussion/help

Reply #1426
https://jscript-panel.github.io/docs/namespaces/plman/#plmanexecuteplaylistdefaultactionplaylistindex-playlistitemindex

Thx. That did the trick. Nice clean randomize button now. Leftclick randomizes, rightclick randomizes and starts playing first item.

Code: [Select]
		fb.RunMainMenuCommand("Playback/Flush playback queue");		// Flush queue in case foo_keep_queue is active
fb.RunMainMenuCommand("Edit/Selection/Sort/Randomize") // Randomize selection and display selection in new order

var FirstSelectedItem = _first_selected_item(plman.ActivePlaylist);
if ( FirstSelectedItem > -1 ) {
plman.ExecutePlaylistDefaultAction(plman.ActivePlaylist, FirstSelectedItem)
}

I keep my queue button rightclick code as is (it works) and start experimenting with the other piece of code you sent.

Re: JScript Panel script discussion/help

Reply #1427
I created a DSP Preset button which works fine.

How can I optimize the following
Code: [Select]
case arr[active].name == 'Upmix to 3.0 (FL FR C)' || arr[active].name == 'Upmix to 4.0 (FL FR BL BR)' || arr[active].name == 'Upmix to 5.0 (FL FR C BL BR)':
which works to something like
Code: [Select]
case arr[active].name[1,5] == 'Upmix':
which does not work.
What is the syntax for matching the first 5 characters of arr[active].name ?

On a similar note ... how can I check for a pattern in a string (for instance) '[exclusive]' ?



Re: JScript Panel script discussion/help

Reply #1430
How do I create a variable var global ?
By changing his value on panel A , it also changing on other panels ?
I need a function that include those variables inside a new .js file ?
Hope it's clear understanding. Thanks 😘

Re: JScript Panel script discussion/help

Reply #1431
Not really sure what you're asking??

You can obviously put variables in your own .js files and import them as documented here...

https://jscript-panel.github.io/docs/preprocessors/

If you want an updated variable in one panel sent to another, use window.NotifyOthers and on_notify_data callback.

https://jscript-panel.github.io/docs/namespaces/window/#windownotifyothersname-info
https://jscript-panel.github.io/docs/callbacks/component/#on_notify_dataname-info

Re: JScript Panel script discussion/help

Reply #1432
Not really sure what you're asking??

You can obviously put variables in your own .js files and import them as documented here...

https://jscript-panel.github.io/docs/preprocessors/

If you want an updated variable in one panel sent to another, use window.NotifyOthers and on_notify_data callback.

https://jscript-panel.github.io/docs/namespaces/window/#windownotifyothersname-info
https://jscript-panel.github.io/docs/callbacks/component/#on_notify_dataname-info
[/quote

Thanks you Marc . You are so reactive to us .
I made it work to change the background color from panel 1 and others panels with the function on notify like you said .
Now I need to change the background to the others layout as well.
Is it possible to send variable from layout to layout ?
Thanks 😘

jscript3 error maybe

Reply #1433
good evening i am using the latest jsript panel 3.3.33 on smooth browser when I add a folder with 100 turns in it adds 200

many thanks in advance

Re: jscript3 error maybe

Reply #1434
when I add a folder with 100 turns in it adds 200

What? Did you mean to say tunes? Show an example screenshot and explain what you think is wrong with it.

Also. 3.3.33 is a long way from being the latest. Anyone using 3.3.30-3.3.39 really should update because there are some rendering bugs when panels are in tabs. 3.340 is the last release for Windows 7/8 users which fixes those bugs. The 3.4.x series requires at least Windows 8.1. The current version is 3.4.28.

Re: jscript3 error maybe

Reply #1435
okay thank you mark all sorted  :)

Re: JScript Panel script discussion/help

Reply #1436
Kind of esoteric question I guess. I had managed to get .jxl support up for the album art set up, by installing the corresponding WIC component. This was on my previous Windows install.

I followed the steps again. I installed a WIC for .jxl that allows the Windows file explorer to display .jxl thumbnails, and the Windows and other photo viewers to display .jxl images. I also know that the JScript Panel is playing well with the WIC, because I can select a .jxl image as a stub for "front cover", and it gets displayed. However, if in Display --> Album Art --> Front Cover --> Search patterns: I put "cover.jxl", something breaks and the album art doesn't get displayed (which is a valid .jxl file called cover.jxl in the folder of the currently playing file). Why could this be?

Re: JScript Panel script discussion/help

Reply #1437
Look like a fb2k bug. I'll have to dig deeper before confirming/reporting it as such.

edit: reported here... https://hydrogenaud.io/index.php/topic,125996.0.html

fb2k 2.0 works as expected. Newer versions do not.


Re: JScript Panel script discussion/help

Reply #1439
@marc2k3

Is there a way to change the default fontsize for tooltips (for instance in your Playback Buttons script)?




Re: JScript Panel script discussion/help

Reply #1443
A script included with JScript Panel 3 already does this...



The obvious downside is that adding your own buttons is not easy.

FWIW, it works by drawing single font symbols so the colour/size can be anything. I use the Segoe Fluent Icons font for my own scripts but anyone writing their own can use whatever font they want.

https://learn.microsoft.com/en-us/windows/apps/design/style/segoe-fluent-icons-font

edit: the included script is called "Menu + Playback Buttons + Custom Colours" available from the Samples button in the Configuration window.

This gif makes it seem like the toolbar would look OK without the window bar. Is it ever thought to add the foo ui hacks functionality straight to the JScript Panel?

Re: JScript Panel script discussion/help

Reply #1444
Is it ever thought to add the foo ui hacks functionality straight to the JScript Panel?

Nope.

a) It's not permitted...

https://github.com/marc2k3/foobar2000-sdk/blob/7f047cf2e541dd2f756c023195ef95285947d201/foobar2000/SDK/core_api.h#L13

Quote
//! Retrieves main app window. WARNING: this is provided for parent of dialog windows and such only; using it for anything else (such as hooking windowproc to alter app behaviors) is absolutely illegal. \n

b) Even if it was allowed, I wouldn't know how.

Re: JScript Panel script discussion/help

Reply #1445
Thanks for the quick response.
I was unaware that the fb2k sdk warns against doing so.
However, I'm not sure how it's illegal since there are plenty of windows apps that are using custom window.
Maybe it's just the fb2k policy, which is fine with me. It makes sense why the outdated foo ui hacks aren't on the list of approved components. Simply said, I think that a lot of users still using it because of its functionality, primarily for custom skins or themes.

Re: JScript Panel script discussion/help

Reply #1446
Hello @marc2k3 I've backed up my system and restored foobar2k with all my plugins to my new install, it was all good till I updated from 3.4.17 to 3.5.1... This piece of code seems to be broken which I'm not sure why?

Code: [Select]
if (currentPlaylist === 1) { command = "File/Random pools/Assign keyboard shortcuts/GensokyoRadio Algorithm [Favourites]: All pools"; }
else { command = "File/Random pools/Assign keyboard shortcuts/GensokyoRadio Algorithm [All]: All pools"; }
fb.RunMainMenuCommand(command);

This exact piece of code worked before and the Random pools plugin hasn't changed at all. I've attached an image to show it's at the same location. I've even discussed this setup over here before as well https://hydrogenaud.io/index.php/topic,110516.msg1036207.html#msg1036207

Also I wanted to let you know that while I downgraded to an older version to check, I've lost all my tags set by JScript3... Luckily I have a backup of my old foobar2k but it would be better if you could put a huge red box to prevent users from downgrading... it looks like when I downgraded in Playback Statistics page you mentioned about how changing the title formatting will just erase the entire database, looks like downgrading did exactly that which caused this issue... Any idea what could be the reason behind this as well?

Re: JScript Panel script discussion/help

Reply #1447
There were changes to how menu items were handled in 3.4.20...

https://jscript-panel.github.io/docs/changes/3-4-x/#3420

Although the changelog only explicitly mentions disabled menu items, it also refuses to run items that are never displayed. It seems like Random pools does exactly this making them for keyboard shortcuts only.

https://github.com/marc2k3/foobar2000-sdk/blob/7f047cf2e541dd2f756c023195ef95285947d201/foobar2000/SDK/menu.h#L53-L54

Quote
//! Retrieves display string and display flags to use when menu is about to be displayed. If returns false, menu item won't be displayed. You can create keyboard-shortcut-only commands by always returning false from get_display().

Running hidden items should be perfectly fine and is expected to work.

---

As for the data loss on downgrade, it's because I changed the SDK target version to fb2k v2. When you upgrade from a v1 compatible component that saved its config in configuration\foo_jscript_panel3.dll.cfg, settings are migrated to config.sqlite and the old .cfg is deleted by fb2k itself. So if you downgrade, the existing configuration stored in config.sqlite is ignored because the component is compatible with v1 again so it relies on that .cfg file that no longer exists - it starts as if it's a fresh install.