This script will allow you to select one of the first 15 user presets (preset not in a sub folder when clicking the preset drop down) via the Stream Deck.
function formatTitle(s) {
var res = '', i = 0;
while (s.length > 0 && i < 3) {
res += s.substring(0, 7) + '\n';
s = s.substring(7);
i++;
}
return res;
}
sf.ui.proTools.appActivate();
//Find the top most floating window containing 'Plug-in:' and locate its preset selector
var win, btn;
{
win = sf.ui.proTools.floatingWindows.whoseTitle.matches(/(^Plug-in|^Audio Suite)/g).first;
if (!win) throw 'Could not find a window';
win.elementRaise({}, 'Could not raise window');
sf.wait({ intervalMs: 50 });
btn = win.popupButtons.whoseTitle.contains('Librarian menu').first;
if (!btn.exists) btn = win.popupButtons.whoseTitle.contains('Preset').first;
}
//Get the presets
var items = btn.popupMenuFetchAllItems().menuItems.map(function (item) {
return {
title: formatTitle(item.names.join(' -> ')),
value: item.names,
color: {
r: 100,
g: 100,
b: 100,
}
};
}).filter(function (item) { return item.value.length === 1; });
//Cancel popup
sf.keyboard.press({ keys: 'esc' });
//Choose a preset via the Stream Deck
var selectedPresetPath = sf.devices.streamDeck.firstDevice.showModal({
items: items
}).selectedItem.value;
//Get focus back
sf.ui.proTools.appActivate();
sf.wait({ intervalMs: 50 });
win.elementRaise();
sf.wait({ intervalMs: 50 });
//Select the preset from the menu
btn.popupMenuSelect({
menuPath: selectedPresetPath,
});
- Dario Ramaglia @dario.ramaglia
Very cool. Just to let you know, this code doesn't recognize folders ;)
Christian Scheuer @chrscheuer2019-04-15 18:48:55.510Z
That's what I was trying to write in the post - it will only take the root items as it is right now, yes.
Dario Ramaglia @dario.ramaglia
Maybe I should learn to read what you write and don't just look at the code ;)
- In reply tochrscheuer⬆:Christian Scheuer @chrscheuer2019-04-17 02:44:21.657Z
Solution in the original post
- GIn reply tochrscheuer⬆:Gregor Arnold @Gregor_Arnold
Hi, very cool script. I have put this in a command and made a button for stream deck called "select Audiouite preset" and layed that on a deck, where also other buttons are populated. When I press the button, the script works as intended: the buttons are populated with my presets and I can selesct one. But after that I would want the deck to return to the previous state. How could that be achieved? As for now the preset names stay on the buttons...
Christian Scheuer @chrscheuer2019-10-11 08:38:07.711Z
Yay that Dario's script is getting more attention :)
The behavior you're seeing is a SoundFlow bug.
We're looking into it.- GGregor Arnold @Gregor_Arnold
Allright then... I'll just have to wait then.
Christian Scheuer @chrscheuer2019-10-11 08:51:58.039Z
@Gregor_Arnold, one workaround might be to call a specific Deck from the script.
To do that, in a Macro use the "Show Deck on Stream Deck" action. Once you've set that up, copy the code to Javascript via the "..." button and insert in your script.
This might work :)- GGregor Arnold @Gregor_Arnold
Yay... indeed it does work... Thanx...cool
Christian Scheuer @chrscheuer2019-10-11 09:00:52.962Z
Wohoo you're quick haha :) Great it worked (for now)!
- ZIn reply tochrscheuer⬆:Zahir Bandukwala @Zahir_Bandukwala
HI ,
I am trying to load a preset named untitled in my Eq preset.
i get this errorThis is the line , where the error occurs.
Christian Scheuer @chrscheuer2020-03-15 20:58:02.251Z
Hi Zahir
Thanks for reporting this. Can I get you to try to use the "Help/Issue" workflow for this so I can review the logs?
To get there, please click the SF icon, then click "Help/Issue" button and follow the instructions on screen.
- In reply tochrscheuer⬆:Andrew Scheps @Andrew_Scheps
This won't help with the error you're getting, but in an attempt to learn some more javascript I've done a version of the name formatting that makes things easier to read on the buttons. I'm sure there are cleaner ways to do this but it works.
function formatTitle(s) { var res = '', i = 0; var numDisplayLines = 0; var maxLineLength = 7; var splitPreset = s.split(" "); if (splitPreset.length < 5) { for (i = 0; i < splitPreset.length - 1; i++) { res += splitPreset[i] + "\n"; } res += splitPreset[splitPreset.length - 1]; } else { while (numDisplayLines < 5 && i < splitPreset.length - 1) { if (splitPreset[i].length + splitPreset[i + 1].length < maxLineLength) { res += splitPreset[i] + " " + splitPreset[i + 1] + "\n"; i = i + 2; } else { res += splitPreset[i]; i++; } numDisplayLines++ } } return res; }
- RIn reply tochrscheuer⬆:Robert Sörling @robertsorling
Wow, found this by chance and it blew me away! So it made me think of something I’ve always wanted: Is it possible in the same manner to get the Stream Deck to dynamically show what inserts are open on a selected track, and by these buttons open an given insert by a press of a stream deck button? Maybe someone already did this (I’ve searched the forum with no luck). Or Maybe it’s not possible …?
- OIn reply tochrscheuer⬆:Oscar Vargas @Oscar_Vargas
This is amazing! Thanks @chrscheuer . How would I be able to modify so that it stays in the layout where it shows all the presets even after choosing one?
I want to use it to denoise dialog (with Clarity - Waves), in my situation it makes sense to be able to try different percentages (every preset has a different percentage) before committing . - NIn reply tochrscheuer⬆:Nick Leyers @Nick.Leyers
Digging up this one. I have a audio suite-window trigger assigned for this script.
That works, but I'm looking for a way to refresh every time I change windows. (so it follows me opening/focussing other audio suite windows)
I can't make that work.My current workaround is pressing an empty slot on the dynamic SD. That gives me an error (index out of range) and then the script does a refresh on the new window.
I've tried to add
sf.ui.proTools.mainWindow.invalidate();
but that doesn't do the trick because once the dynamic deck is visible, it stays there.Besides that: having 1 button on my stream deck that is not dynamic (for returning to another deck for example) might be handy. Can dynamic decks be combined with static buttons?