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 288396 times) previous topic - next topic
0 Members and 1 Guest 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]' ?