I wanting to create a new "Stereo / Instrument / Sample Based" track that I can insert any plugin I want on in the first slot. This will trigger from a StreamDeck.
I have this code so far and it wont do anything except open the "New track" UI:
sf.ui.proTools.menuClick({
menuPath: ["Track","New..."],
looseMatch: false,
targetValue: "Toggle",
forceClick: false,
executionMode: "Foreground",
onError: "ThrowError",
});
sf.ui.proTools.windows.whoseTitle.is('New Tracks').first.elementWaitFor();
// Selectring Stereo Track
sf.keyboard.press({
keys: "cmd+right",
});
// Selecting Instrument Track
sf.keyboard.press({
keys: "cmd+down",
repetitions: 5,
fast: false,
});
Any suggestions would be fantastic. Thank you!
Linked from:
- Raphael Sepulveda @raphaelsepulveda2020-12-03 23:17:56.353Z
Hey Mike,
To answer your initial question. Here is how you can create that Instrument Track:
const newTracksWin = sf.ui.proTools.windows.whoseTitle.is('New Tracks').first; sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.menuClick({ menuPath: ["Track", "New..."], }) newTracksWin.elementWaitFor(); newTracksWin.popupButtons.first.popupMenuSelect({ menuPath: ["Stereo"] }); newTracksWin.popupButtons.allItems[1].popupMenuSelect({ menuPath: ["Instrument Track"], }); newTracksWin.popupButtons.allItems[2].popupMenuSelect({ menuPath: ["Samples"], }); newTracksWin.buttons.whoseTitle.is('Create').first.elementClick(); newTracksWin.elementWaitFor({ waitType: "Disappear" });
But my suggestion for what you want to ultimately do would be to use Track Presets. Make a Track Preset for that Instrument track with the plugin you want on the first insert slot and then use SoundFlow to create it.
Here's an example of how I create a Kontakt instrument track. You'll have to change the menu paths to the location of your track preset.const newTracksWin = sf.ui.proTools.windows.whoseTitle.is('New Tracks').first; sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.menuClick({ menuPath: ["Track", "New..."] }); newTracksWin.elementWaitFor(); // Change path here newTracksWin.popupButtons.allItems[1].popupMenuSelect({ menuPath: ["Track Presets", "Raph", "Production", "Kontakt"], }); // And here newTracksWin.popupButtons.first.popupMenuSelect({ menuPath: ["Kontakt.VI"], }); newTracksWin.buttons.whoseTitle.is('Create').first.elementClick(); newTracksWin.elementWaitFor({ waitType: "Disappear" });
Let me know if that makes sense!
- MMike Avenaim @Mike_Avenaim
Ok great. Good idea with the track presets. Ill try that. What is the "KONTAKT.VI" pointing to?
- DDamon Castillo @Damon_Castillo
I'm also wondering what "Kontakt.VI" is pointing to... Haven't gotten this to work just yet.
Raphael Sepulveda @raphaelsepulveda2021-05-18 03:25:00.943Z
Check my reply below!
- In reply toraphaelsepulveda⬆:MMike Avenaim @Mike_Avenaim
im getting hung up here:
Could not click popup menu item (Create Kontakt 5: Line 10)
Could not find menu item with name: Track Presets -> Avenaim -> Stream Deck -> Kontakt 5Its just stopping at the New Track UI element
- MMike Avenaim @Mike_Avenaim
I fixed it... I had one wrong thing in the chain!
Raphael Sepulveda @raphaelsepulveda2020-12-03 23:44:20.906Z
Perfect! Glad that worked out!
- In reply toraphaelsepulveda⬆:
Kitch Membery @Kitch2020-12-04 00:33:17.214Z
Hi @Mike_Avenaim ya champion!,
Just to add onto Raphael's excellent suggestions here. When working with popup menus its best not to use keyboard simulation... instead use the "Open & Select Item in Popup Menu" Macro Action.
So where you had this;
//Select "Stereo Track" sf.keyboard.press({ keys: "cmd+right", });
Will becomes this;
//Select "Stereo Track" sf.ui.proTools.windows.whoseTitle.is('New Tracks').first.popupButtons.first.popupMenuSelect({ menuPath: ["Stereo"], });
Rock on!
- MMike Avenaim @Mike_Avenaim
Killer... ill replace that now
Thank you
Kitch Membery @Kitch2020-12-04 00:53:27.886Z
@raphaelsepulveda's scripts already use the "Open & Select Item in Popup Menu" code so no need to change his scripts :-)
Just thought I'd give you the heads up. :-)
- MMike Avenaim @Mike_Avenaim
Yes, i caught that! Thanks man
- In reply toraphaelsepulveda⬆:DDamon Castillo @Damon_Castillo
Total newbie here, but I would like to do the same as Mike. I'm getting ...
New Kontakt Track failed, could not click popup menu item (New Kontakt Track: Line 10).
Any ideas on what I'm doing wrong? Thanks!Raphael Sepulveda @raphaelsepulveda2021-05-18 03:24:36.623Z
Hey Damon!
I have a command for creating new tracks with track presets in my utilities package that can do this for you!
I'd suggest you try that first since all the bugs have been worked out. If you're still having issues let me know and I'll take a look!
- DDamon Castillo @Damon_Castillo
Raphael!
It works brilliantly! Thanks!
Damon
- IIn reply toMike_Avenaim⬆:Iuri Cunha @Iuri_Cunha
Hi guys, every time I try to run this script or Raphael's macro I get an error saying it could not click the menu item with my track preset's name even though I put the preset menu with the correct path. Any idea of what I might be the issue?
Raphael Sepulveda @raphaelsepulveda2023-12-08 22:10:45.296Z
Could you give us more information? What is your preset's path and how are you putting it in the script or the macro? A video of it failing always helps a ton.
- IIuri Cunha @Iuri_Cunha
Hi, This is an example of the script was running to make a new track from a preset I called "Piano". I had it working for a couple of days but for some reason it just stopped, and all other scripts that I used to make other tracks from presets aren't working. I always get an error on line 10. It's like it's unable to find the "Track Preset" and "User" buttons in the menu. Whenever I try to run your version of it from the utilities package I also get an error on line 31 and get stuck with the new track window. Any Ideas why this might be happening?
const newTracksWin = sf.ui.proTools.windows.whoseTitle.is('New Tracks').first; sf.ui.proTools.appActivateMainWindow(); sf.ui.proTools.menuClick({ menuPath: ["Track", "New..."] }); newTracksWin.elementWaitFor(); // Change path here newTracksWin.popupButtons.allItems[1].popupMenuSelect({ menuPath: ["Track Presets","User"] }); // And here newTracksWin.popupButtons.first.popupMenuSelect({ menuPath: ["Piano"], }); newTracksWin.buttons.whoseTitle.is('Create').first.elementClick(); newTracksWin.elementWaitFor({ waitType: "Disappear" });
Raphael Sepulveda @raphaelsepulveda2023-12-12 01:05:04.802Z
Mmm, I've recreated your track preset structure to try and repro the error but no dice.
I'm thinking maybe this could be that old Melodyne folder bug from a while back. Check out this thread so you know what I'm talking about. Basically, in rare circumstances, there's a chance that Pro Tools creates a Melodyne folder inside one of the track preset folders which breaks the ability to select a menu item in the same popup menu you're having trouble with. Could you go to your Track Presets folder in Finder and see if there is a Melodyne folder somewhere in there? If so, delete it and try again.
- IIuri Cunha @Iuri_Cunha
That was it!! Thank you!! It works now!