Hello
I'm trying to click on a window configuration by its name, since I found by number its not consistent for me.
I'm using,
sf.ui.proTools.menuClick({
looseMatch: true,
menuPath: ["Window", "Configurations","CONFIG NAME HERE"]
But for some reason, it looks like the configurations from the menu are not available.
Any Help?
Thank you
- Chris Shaw @Chris_Shaw2020-09-05 22:25:55.161Z
Hmm, not sure. It seems that Loose Match only works if the name starts with the same characters that you're looking for rather than a set of characters within the name. Like shown below, I can do a loose match with "99" but not "Window Reset".
Perhaps @chrscheuer can chime in?
- In reply tosamuel_henriques⬆:Kitch Membery @Kitch2020-09-06 03:07:37.634Z
Hi @samuel_henriques & @Chris_Shaw,
Somthing like this should do it... There is probably an easier way :-)
function selectWindowConfigByName(configName) { let windowConfigurationsMenu = sf.ui.proTools.getMenuItem('Window').children.first.children.first.children.first.children; let configMenuItems = windowConfigurationsMenu.map(c => c.title.invalidate().value).join(', ').split(', '); let menuItemToSelect = configMenuItems.filter(m => m.includes(configName))[0]; sf.ui.proTools.menuClick({ looseMatch:true, menuPath: ["Window", "Configurations", menuItemToSelect], }); } selectWindowConfigByName('Window Reset');
Rock on!!!
Kitch Membery @Kitch2020-09-06 03:10:48.494Z
BTW to select the window configuration you want simply update the following line;
selectWindowConfigByName('ENTER WINDOW CONFIGURATION NAME HERE');
Christian Scheuer @chrscheuer2020-09-06 11:58:50.009Z
This is great... I'd do it just ever so slightly differently, but Kitch's method is perfectly valid too :)
function selectWindowConfigByName(windowConfigName) { var allConfigurationItems = sf.ui.proTools.getMenuItem('Window', 'Configurations').children.first.children.map(c => { var m = c.title.value.match(/^(\d+):\s+(.+)$/); return { num: m && Number(m[1]), title: m && m[2], element: c, }; }).filter(i => i.num); var item = allConfigurationItems.filter(i => i.title === windowConfigName)[0]; if (!item) throw `Could not find window configuration with name: "${windowConfigName}"`; item.element.elementClick(); } selectWindowConfigByName('Window Reset');
samuel henriques @samuel_henriques
Hello Kitch and Christian,
Thank you so much, both codes work great,
now,
how to I had a function when he doesn't find the window configuration?Thank you both
Christian Scheuer @chrscheuer2020-09-06 13:12:32.037Z
I'm not sure I follow your question. Can you clarify?
- In reply tosamuel_henriques⬆:
samuel henriques @samuel_henriques
I use a session on the desktop named "T" with the configuration I need.
Every time I make adjustment on any session I'm working, I copy the session to the desktop and name it "T"this is the function I made to import session data from it
function importt() { sf.keyboard.press({ keys: "alt+shift+i", }); var folder = "/Users/PPA_01/Desktop/T.ptx"; sf.keyboard.type({ text: folder }); sf.keyboard.press({ keys: 'enter' }); sf.ui.proTools.windows.first.buttons.whoseTitle.is('Open').first.elementClick(); sf.ui.proTools.windows.whoseTitle.is('Import Session Data').first.groups.whoseTitle.is('Session Data').first.checkBoxes.whoseTitle.is('Tempo / Meter Map').first.checkboxSet({ targetValue: "Disable", }); sf.ui.proTools.windows.whoseTitle.is('Import Session Data').first.groups.whoseTitle.is('Session Data').first.checkBoxes.whoseTitle.is('Key Signature / Chord Map').first.checkboxSet({ targetValue: "Disable", }); sf.ui.proTools.windows.whoseTitle.is('Import Session Data').first.groups.whoseTitle.is('Session Data').first.checkBoxes.whoseTitle.is('Markers / Memory Locations').first.checkboxSet({ targetValue: "Disable", }); sf.ui.proTools.windows.whoseTitle.is('Import Session Data').first.groups.whoseTitle.is('Session Data').first.checkBoxes.whoseTitle.is('Window Configurations').first.checkboxSet({ targetValue: "Enable", }); sf.ui.proTools.windows.whoseTitle.is('Import Session Data').first.groups.whoseTitle.is('Session Data').first.checkBoxes.whoseTitle.is('Mic PRE Settings').first.checkboxSet({ targetValue: "Disable", }); sf.ui.proTools.windows.whoseTitle.is('Import Session Data').first.groups.whoseTitle.is('Session Data').first.radioButtons.whoseTitle.is('Do Not Import').first.checkboxSet({ targetValue: "Enable", }); sf.ui.proTools.windows.whoseTitle.is('Import Session Data').first.buttons.whoseTitle.is('OK').first.elementClick(); }
this script works fine is the number and name of the window configuration is constant,
sf.ui.proTools.appActivateMainWindow(); if (sf.ui.proTools.getMenuItem("Window", "Configurations", "99: PPA_01_WIN CONFIG").exists){ sf.ui.proTools.menuClick({ looseMatch: true, menuPath: ["Window", "Configurations", "99: PPA_01_WIN CONFIG"] }); }else { importt() function importt() { sf.keyboard.press({ keys: "alt+shift+i", }); var folder = "/Users/PPA_01/Desktop/T.ptx"; sf.keyboard.type({ text: folder }); sf.keyboard.press({ keys: 'enter' }); sf.ui.proTools.windows.first.buttons.whoseTitle.is('Open').first.elementClick(); sf.ui.proTools.windows.whoseTitle.is('Import Session Data').first.groups.whoseTitle.is('Session Data').first.checkBoxes.whoseTitle.is('Tempo / Meter Map').first.checkboxSet({ targetValue: "Disable", }); sf.ui.proTools.windows.whoseTitle.is('Import Session Data').first.groups.whoseTitle.is('Session Data').first.checkBoxes.whoseTitle.is('Key Signature / Chord Map').first.checkboxSet({ targetValue: "Disable", }); sf.ui.proTools.windows.whoseTitle.is('Import Session Data').first.groups.whoseTitle.is('Session Data').first.checkBoxes.whoseTitle.is('Markers / Memory Locations').first.checkboxSet({ targetValue: "Disable", }); sf.ui.proTools.windows.whoseTitle.is('Import Session Data').first.groups.whoseTitle.is('Session Data').first.checkBoxes.whoseTitle.is('Window Configurations').first.checkboxSet({ targetValue: "Enable", }); sf.ui.proTools.windows.whoseTitle.is('Import Session Data').first.groups.whoseTitle.is('Session Data').first.checkBoxes.whoseTitle.is('Mic PRE Settings').first.checkboxSet({ targetValue: "Disable", }); sf.ui.proTools.windows.whoseTitle.is('Import Session Data').first.groups.whoseTitle.is('Session Data').first.radioButtons.whoseTitle.is('Do Not Import').first.checkboxSet({ targetValue: "Enable", }); sf.ui.proTools.windows.whoseTitle.is('Import Session Data').first.buttons.whoseTitle.is('OK').first.elementClick(); sf.ui.proTools.menuClick({ looseMatch: true, menuPath: ["Window", "Configurations", "99: PPA_01_WIN CONFIG"] }); } }
Thank you all
samuel henriques @samuel_henriques
I might just be over complicating this whole thing..
If I just keep the name and number it should work regardless...
Thank you guys so much...It's been a great leaning experience- MMicah Loken @Micah_Loken
Hey @samuel_henriques,
I'm curious if you have figured out a newer/updated method for your import? I am also doing a similar method of saving out the window config to the desktop to import into other sessions. Thanks!
- In reply tochrscheuer⬆:
Kitch Membery @Kitch2020-09-06 22:12:27.121Z
So good!!! I have to get my head around regex. :-)
- In reply tosamuel_henriques⬆:Christian Scheuer @chrscheuer2020-09-06 11:51:01.452Z
You can use the built in SoundFlow command for this:
sf.ui.proTools.windowConfigurationSelect({ number: 1, });
- In reply tosamuel_henriques⬆:AlexanderW @AlexanderW
Is there a way that SF reads out all stored window configurations from the currently opened session and put their names on buttons on the deck so that I can see them and choose one by just pressing the button?
Same thing would be awesome for previously stored Eucon Layouts.
Chris Shaw @Chris_Shaw2020-09-17 21:06:44.692Z
It is somewhat possible but requires some pretty complicated programming. Check out Andrew Scheps' Toggle Decks to see how something like this works.
AlexanderW @AlexanderW
Ok, I think it could be worth the effort. I'm going to take a look at it. Thank you
- In reply toChris_Shaw⬆:
AlexanderW @AlexanderW
I found a script from Andrew that saves and recalls Configs, which may be very useful but not really does the trick I am looking for. Or am I overseeing something?
- In reply toAlexanderW⬆:
Chris Shaw @Chris_Shaw2020-09-17 21:17:16.441Z
FYI - There already is a Eucon Layouts package that Christian put up on the store
AlexanderW @AlexanderW
I saw that, but the layouts are there just by number. You can't see the actual name of it. So it's mostly usable if you have always the same configs at the same number, which may not necessarily be the case