Like the title say.
Now i have to say which slot i want to occupy. that means i have to have a button for every slot.
I'd love a macro that just inserts a PI from the list in the first available empty slot.
- Christian Scheuer @chrscheuer2019-06-19 19:43:55.161Z
Hi @Fokke
This script will insert a plugin (and ask you which one) for the first available insert slot:
function getFirstFreeInsertIndex() { var btns = sf.ui.proTools.selectedTrack.invalidate().insertButtons; for (var i = 0; i < 10; i++) if (btns[i].value.invalidate().value === "unassigned") return i; return -1; } sf.ui.proTools.selectedTrack.trackInsertOrSendSearch({ insertOrSend: 'Insert', pluginNumber: getFirstFreeInsertIndex() + 1, });
Christian Scheuer @chrscheuer2019-06-19 19:45:55.545Z
If you want to add a specific plugin, use this script:
function getFirstFreeInsertIndex() { var btns = sf.ui.proTools.selectedTrack.invalidate().insertButtons; for (var i = 0; i < 10; i++) if (btns[i].value.invalidate().value === "unassigned") return i; return -1; } sf.ui.proTools.selectedTrack.trackInsertOrSendSelect({ insertOrSend: 'Insert', pluginNumber: getFirstFreeInsertIndex() + 1, pluginPath: ['plug-in', 'EQ', 'EQ3 7-Band (mono)'] });
- GGraham Archer @Graham_Archer
Hey @chrscheuer how do you do this for multiple tracks? As I want to put the same plugin across multiple tracks - I tried adding:
sf.keyboard.modifiers({ isShift: true isOption: true, });
But it didn't seem to have any effect. Any help would be much appreciated!
Christian Scheuer @chrscheuer2019-10-21 14:45:27.286Z
Add
selectForAllSelectedTracks: true
to the last action:function getFirstFreeInsertIndex() { var btns = sf.ui.proTools.selectedTrack.invalidate().insertButtons; for (var i = 0; i < 10; i++) if (btns[i].value.invalidate().value === "unassigned") return i; return -1; } sf.ui.proTools.selectedTrack.trackInsertOrSendSelect({ insertOrSend: 'Insert', pluginNumber: getFirstFreeInsertIndex() + 1, pluginPath: ['plug-in', 'EQ', 'EQ3 7-Band (mono)'], selectForAllSelectedTracks: true, });
Note this will only check the 1st selected track for the next available insert, so any further selected tracks with inserts on that particular slot will be overridden.
- GGraham Archer @Graham_Archer
Brilliant! Thanks so much @chrscheuer - works perfectly. So useful.
- GGraham Archer @Graham_Archer
Hey @chrscheuer,
I just wanted to know if this is possible - basically I want to cycle through each plugin, opening the plugin window, wait, press a shortcut, close the plugin window and then move on to the next plugin on the next selected track. I'm guessing this will be in a for loop for the number of selected tracks, something like:
sf.ui.proTools.selectedTrack.trackInsertToggleShow(); sf.wait({ intervalMs: 2000, }); sf.keyboard.press({ keys: 'shift+ctrl+alt+cmd+t' }); sf.ui.proTools.selectedTrack.trackInsertToggleShow();
Also inserting the plugins seems to be dependant on track height - as in if the track height is 'mini' or 'micro' the plugin won't get inserted, but small or bigger seems fine. Is that intentional?
As ever, thanks in advance!
Christian Scheuer @chrscheuer2019-10-22 14:16:24.611Z
What does the shortcut do?
- GGraham Archer @Graham_Archer
It's for Melodyne - I've got it set to hit the 'Transfer' button but that's a custom allocation that I've made.
- In reply tochrscheuer⬆:
Mike Wax @mikewax
Hello, I was wondering if this was possible to do on a specific track? For example, if i have Track A, Track B, Track C, Track D, can i have it insert the plugin on Track B?
Christian Scheuer @chrscheuer2020-06-22 20:49:34.334Z
Hi Mike.
Right now the script uses
sf.ui.proTools.selectedTrack
in a few places.
You could use a call tosf.ui.proTools.trackGetByName( ... )
to make it happen on a specific track.Mike Wax @mikewax
It's throwing an error about
invalidate()
This is what i have:
`function getFirstFreeInsertIndex() {
var btns = sf.ui.proTools.trackGetByName('RX').invalidate().insertButtons;
for (var i = 0; i < 10; i++)
if (btns[i].value.invalidate().value === "unassigned") return i;
return -1;
}sf.ui.proTools.selectedTrack.trackInsertOrSendSelect({
insertOrSend: 'Insert',
pluginNumber: getFirstFreeInsertIndex() + 1,
pluginPath: ['multichannel plug-in', 'Noise Reduction', 'RX 7 Monitor (stereo)']
});`Christian Scheuer @chrscheuer2020-06-22 20:59:09.141Z
Hi Mike.
Try this instead:
const track = sf.ui.proTools.trackGetByName({ name: 'RX' }).track; function getFirstFreeInsertIndex() { var btns = track.insertButtons; for (var i = 0; i < 10; i++) if (btns[i].value.invalidate().value === "unassigned") return i; return -1; } track.trackInsertOrSendSelect({ insertOrSend: 'Insert', pluginNumber: getFirstFreeInsertIndex() + 1, pluginPath: ['multichannel plug-in', 'Noise Reduction', 'RX 7 Monitor (stereo)'] });
Mike Wax @mikewax
It seems to still be throwing an error:
Error: Parent's UIElement was null: SoundFlow.Shortcuts.AXUIElementException: kAXErrorInvalidUIElement at SoundFlow.Shortcuts.AXUIElement.GetSubElements(String) + 0x1a4 at SoundFlow.Shortcuts.Ax.AxNodes.AxPtTrackInsertSendButton.GetUIElement() + 0xe6 at SoundFlow.Shortcuts.Ax.AxNodes.AxElement.LoadUIElement() + 0x2a (AxPtTrackInsertSendButton) (Add RX Monitor line 31)
Christian Scheuer @chrscheuer2020-06-23 08:22:53.458Z
Are you having all insert buttons showing, and is the track RX visible?
- In reply tochrscheuer⬆:NNacho @Nacho_Sotelo
Is there a way to do this but instead of using the SoundFlow search menu, use the Pro Tools search?
Something like select the first free insert and activate search menu item
Christian Scheuer @chrscheuer2020-04-07 11:27:37.146Z
Brilliant idea :)
Yes - here's how to do that:
function getFirstFreeInsertIndex() { var btns = sf.ui.proTools.selectedTrack.invalidate().insertButtons; for (var i = 0; i < 10; i++) if (btns[i].value.invalidate().value === "unassigned") return i; throw 0; } sf.ui.proTools.selectedTrack.insertButtons[getFirstFreeInsertIndex()].popupMenuSelect({ menuPath: ['search...'] });
- NNacho @Nacho_Sotelo
Works great here, thank you!
- In reply tochrscheuer⬆:RRobert Sörling @robertsorling
Hi! Is there a way to do this for a given insert slot? For example ”open protools own search field for insert number 3 on selected track”?
Christian Scheuer @chrscheuer2020-09-13 23:21:34.850Z
Yes, you just put in the insert index (one less than the insert number) - so to do this for the 3rd I put in 2 here:
sf.ui.proTools.selectedTrack.insertButtons[2].popupMenuSelect({ menuPath: ['search...'] });
- In reply tochrscheuer⬆:JJoe Kearns @Joe_Kearns
this is so good.
is there a way to make it automatically type in a specific plugin and press enter after it gets to the PT search menu please?
Christian Scheuer @chrscheuer2021-09-07 11:00:36.304Z
Hi Joe,
Have you checked out the Teezio Plugin Loader? It does all this fully automatically for you :)
- GIn reply toFokke⬆:Graham Archer @Graham_Archer
Hey @chrscheuer apologies I had this working and now it seems to be not working and I'm not quite sure why! Here's the code I'm using:
//Only works on tracks with vertical height of small or larger //Get first free insert function getFirstFreeInsertIndex() { var btns = sf.ui.proTools.selectedTrack.invalidate().insertButtons; for (var i = 0; i < 10; i++) if (btns[i].value.invalidate().value === "unassigned") return i; return -1; } var numberOfTracks = sf.ui.proTools.selectedTrackCount; //Insert Melodyne sf.ui.proTools.selectedTrack.trackInsertOrSendSelect({ insertOrSend: 'Insert', pluginNumber: getFirstFreeInsertIndex() + 1, pluginPath: ['plug-in', 'Other', 'Melodyne (mono)'], //pluginPath: ['plug-in', 'Dynamics', 'BF-2A (mono)'], selectForAllSelectedTracks: true, });
The script is flagging an error saying
Error in line 11:
Could not select plugin menu item: 'plug-in', 'Other', 'Melodyne (mono)'Do you need to specify whether the plugin is DSP or Native as well? That's just a guess on my part but I've tried a few things and can't get it to work. Any help would be much appreciated!
Thanks!
Graham
- GIn reply toFokke⬆:Graham Archer @Graham_Archer
Hey @chrscheuer
I had this working great but now I can't even get this simpler code to insert a plugin:
sf.ui.proTools.selectedTrack.trackInsertOrSendSelect({ insertOrSend: 'Insert', pluginNumber: 1, pluginPath: ['plug-in', 'Other', 'Melodyne (mono)'] });
Does the pluginPath need to be 'mono plug-in'? Or has something changed to trackInsertOrSendSelect? Or is there something glaringly obvious that I'm not seeing?
Please let me know when you can.
Many thanks!
Christian Scheuer @chrscheuer2020-01-08 17:20:46.623Z
Hi Graham.
The path needs to be exactly identical to how it looks in the UI. So if the menu's name is mono plug-in then yes that's what your script should say.
Without a screenshot of the actual menu you're trying to script it's hard to tell you what the script should look like.
- GIn reply toFokke⬆:Graham Archer @Graham_Archer
Hey!
OK sure thing - I've attached a screenshot so you can see.
Apologies I'm a bit stumped as to why it did work and now it's not.
Any help would be much appreciated.
Thank you!
Christian Scheuer @chrscheuer2020-01-08 20:18:28.856Z
Hi Graham.
Mark these words I said before:
The path needs to be exactly identical to how it looks in the UI.
With emphasis on exactly identical
Your screenshot clearly shows the first level menu item is called "Native plug-in" while your script just says "plug-in":
sf.ui.proTools.selectedTrack.trackInsertOrSendSelect({ insertOrSend: 'Insert', pluginNumber: 1, pluginPath: ['plug-in', 'Other', 'Melodyne (mono)'] });
The reason why this worked before and doesn't work now is that Pro Tools in the current context (your current session on the current track) displays a different menu (it used to be named "plug-in" but is now named "Native plug-in".
The reason for that might be that on this track on this system you now have access to DSP enabled plugins, which you didn't have (due to either system, track types or other routing patterns) when this script worked before.Unfortunately the Track Insert Or Send Select action does not accept the plugin path if it's not (and I repeat) exactly identical to the path in the menu.
Christian Scheuer @chrscheuer2020-01-08 20:21:29.171Z
I still wanna make sure you understand this part, but once you are on board with this, I think the question we should be asking instead should be - is there a way to choose from different menus depending on what succeeds or not.
And yes there is - several ways. But I wanna make sure you understand the concept before we make it more complex.Christian Scheuer @chrscheuer2020-01-08 20:38:30.571Z
In other words, what we can deduce is that Pro Tools' first level menu items for plugins change names depending on situation.
They can be:
Mono channel, no DSP
- plug-in
Multi channel, no DSP
- multichannel plug-in
- multi-mono plug-in
Mono channel, with DSP
- DSP plug-in
- Native plug-in
Multi channel, with DSP
Actually - I'm not sure about this since I don't have DSP access here...
- DSP multichannel plug-in
- DSP multi-mono plug-in
- Native multichannel plug-in
- Native multi-mono plug-in
Christian Scheuer @chrscheuer2020-01-08 20:41:05.461Z
So you can see theoretically there are 9 different names for that first menu. If we didn't have the powers of SoundFlow javascripting then you'd essentially have to make 9 different commands - and that would suck.
So what we should design instead is a command that allows you to say:- Select Melodyne on insert 1
- Choose Multichannel or multi-mono if we are potentially on a multi channel track (eg. stereo)
- Choose DSP or Native if we are potentially on a DSP enabled system and the current insert slot position allows for DSP
- GGraham Archer @Graham_Archer
Yes I think you're right, it would be good and more robust if the script selected Melodyne regardless of whether or not you were working on a DSP system or a non-DSP system, or if you had a mono or multichannel track selected. How can I interrogate the first level of the plugin path? With a series of 'if' statements?
- In reply tochrscheuer⬆:
Andrew Scheps @Andrew_Scheps
Did you guys ever go any further on this? I'd love to see an example of the version that can deal with all the different variations of the plugin menu.
I've done a simple mono/stereo version using error handling, but to make this handle the 9 possibilities would make it quite messy. It also opens the menu each time it's checking so if you got to the ninth possibility that would be a LOT of menu flashing. Is there a way to read the text of the popup menu to determine the correct version of the command to use?
sf.ui.proTools.selectedTrack.trackInsertOrSendSelect({ insertOrSend: "Insert", pluginNumber: 1, pluginPath: ["plug-in","EQ","EQ3 7-Band (mono)"], }, function(notMonoTrack) { sf.ui.proTools.selectedTrack.trackInsertOrSendSelect({ insertOrSend: "Insert", pluginNumber: 1, pluginPath: ["multichannel plug-in","EQ","EQ3 7-Band (stereo)"], })});
Christian Scheuer @chrscheuer2020-02-23 20:16:00.657Z
I think we need an update to SoundFlow for scripts to have access to filter dynamically on the menu path. I'll log a bug report for this so we make sure to address it.
Christian Scheuer @chrscheuer2020-03-09 21:08:04.640Z
Confirming we'll get a way to do this more elegantly in 3.5
Chad Wahlbrink @Chad2020-03-29 14:18:52.817Z
Hey! I was curious if this is something that has been addressed in a more recent update or if this is still being worked on?
Christian Scheuer @chrscheuer2020-03-29 14:28:00.861Z
Hi Chad
Yes - you can see more here:
https://forum.soundflow.org/-1693#post-9and here:
https://forum.soundflow.org/-1693#post-8Chad Wahlbrink @Chad2020-03-29 16:38:49.160Z
Thanks so much! This app is incredible. You are a hero.
- In reply tochrscheuer⬆:GGraham Archer @Graham_Archer
Also I just wanted to post a screenshot of the first level menu items on a multichannel track on a DSP system in case you or anyone else needed it or found it useful for syntax.
Christian Scheuer @chrscheuer2020-01-09 21:06:38.812Z
Thanks for the screenshot!
- In reply tochrscheuer⬆:GGraham Archer @Graham_Archer
Yes you are exactly right - apologies, I must have been on a non-DSP Pro Tools system when I tested this last and it worked fine and then moved to my main setup which is DSP based. Now I understand why it didn't work, so thank you!