How to commit a MIDI track and copy the result
I am trying to create a command where I "Commit" a midi track, copy the newly created audio clip and delete the audio track so I can them "Paste" that audio on another, already created Audio track. This is how far I have gotten with Copy/Paste scripts from the help but some how when I enter the Delete command after this, the file is not Copied and I can't paste it where I want..Thaks kindly!
sf.ui.proTools.menuClick({ menuPath: ["Track", "Commit..."], });
var dlg = sf.ui.proTools.windows.whoseTitle.is('Commit Tracks').first.elementWaitFor().element;
dlg.buttons.whoseTitle.is('OK').first.elementClick();
dlg.elementWaitFor({ waitForNoElement: true });
sf.ui.proTools.menuClick({ menuPath: ["Edit", "Copy"], });
- Christian Scheuer @chrscheuer2020-12-19 00:20:43.433Z
Hi Todor,
This is a good start, but it doesn't appear to be waiting for the Commit to complete, in the event where it'll show the progress bar.
It only waits for the "Commit Tracks" dialog to disappear after press OK, but you're not catching the window with the progress bar that renders the audio.You can ensure that by adding:
sf.wait({ intervalMs: 2000 }); sf.ui.proTools.waitForNoModals();
The first wait is there to ensure any progress bar has a chance of showing up, and the second call then waits to ensure no modal dialogs are present.
Finally, after that, you'll need to invalidate SoundFlow's track cache, because you will have added a new track through the process.
You do that like this:sf.ui.proTools.mainWindow.invalidate();
All of these should be inserted right before Edit->Copy.
Make sure to test that part of the script thoroughly to see if the new audio actually gets copied correctly, before adding the delete command.
- TIn reply toTodor_Kobakov⬆:Todor Kobakov @Todor_Kobakov
Hi Christian,
Thank you so much for your time and help! For some reason I still can't get it to work. This is where I am at so far. I get to Copy but get stuck from this point on to add Delete Selected Track, Delete on the pop-up window.
sf.ui.proTools.trackDelete(); Seemed to brake everything..sf.ui.proTools.menuClick({ menuPath: ["Track", "Commit..."], }); var dlg = sf.ui.proTools.windows.whoseTitle.is('Commit Tracks').first.elementWaitFor().element; dlg.buttons.whoseTitle.is('OK').first.elementClick(); dlg.elementWaitFor({ waitForNoElement: true }); sf.wait({ intervalMs: 2000 }); sf.ui.proTools.waitForNoModals(); sf.ui.proTools.mainWindow.invalidate(); sf.ui.proTools.menuClick({ menuPath: ["Edit", "Copy"], });
Kitch Membery @Kitch2020-12-20 00:53:56.939Z
Hi @Todor_Kobakov,
I have already reformated the code in this post for you, but here is a tutorial for how to quote code in the SoundFlow forum, so that it displays in a readable format:
Rock on
Kitch- In reply toTodor_Kobakov⬆:
Kitch Membery @Kitch2020-12-20 01:03:56.174Z
Hi @Todor_Kobakov,
I believe if you delete the track before you paste the audio, Pro Tools clears the clipboard's contents (unfortunatly). Try removing the last line
sf.ui.proTools.trackDelete();
and using the paste function after and you will see what I mean. Unfortinatly this is out of SoundFlows control.If you know where you want to paste the audio you could make the script paste then delete the track afterwards. Just a thought.
Hope that helps.- TTodor Kobakov @Todor_Kobakov
Got it, thanks Kitch!
- TIn reply toTodor_Kobakov⬆:Todor Kobakov @Todor_Kobakov
Aha! Thanks so much Kitch!
Kitch Membery @Kitch2020-12-20 01:05:46.039Z
You're totally welcome :-)