edit Solution below in post #3 by Kitch, ignore my code.
Heya! Brand new to SoundFlow, and my java is beyond basic, so hopefully someone can help me fix the error of my ways, or bad formatting, or any help! :)
Briefly, I have a script that copies (and stores in a JSON file) a selected clips name (in this case the filename of the film in my session). With this clip selected, and region defined in PT, It then selects all stems and print masters in my project. Opens track Bounce dialog. Copy pastes names into the bounce dialog window. Asks me to input my internal versioning info to append to the file name and folder hierarchy. Bounces. Waits. Moves exported files into their own organized folders though finder etc etc. Then it goes back into PT and does the same but enables mastering limiters for a version for Web. Then it opens (through sf.system.exec CommandLine) the Final mix print masters in Izotope 9.3.0 (standalone) and checks (and processes) their loudness using presets in the Loudness Control Module to double check I'm in spec.
So at the end, I have a broadcast print and an online (web) print, and their stems, all neat and tidy and ready for upload as is. Brilliant. All works fine except the fact that I cannot get Izotope to wait between processing my Broadcast loudness and Online Loudness presets.
Here is my izotope " Wait" code, stolen from someone on the forums, with some additions to account for the fact that the file opened in IZotope will always have a different name depending on the name of the film:
let processPath = `${clipName}_BROADCAST_${versionName}` ;
function waitForIzotopeProcessing() {
const isProcessing = () =>
sf.ui.izotope.windows.whoseTitle.startsWith(`${processPath}`).exists ||
sf.ui.izotope.windows.whoseTitle.startsWith("Composite").exists;
sf.wait({ intervalMs: 1000 });
while (isProcessing()) {
sf.wait({ intervalMs: 500 });
}
}
In this above example, I have clipName and versionName pulling both these values from a stored JSON.
FYI, it saves like this:
//save settings (goes in the script that saves the settings)
let clipName = sf.clipboard.getText().text;
//let setting_two = "Is";
//let setting_three = "Cool";
let settingsToSave = {
clipName,
// setting_two,
// setting_three,
};
//this saves the settings file in the package directory of the command it is run from
let jsonSavePath = sf.soundflow.thisPackage.getDirectory().path + '/savedClipSettings.json';
let success = sf.file.writeJson({
path: jsonSavePath,
json: settingsToSave
}).success;
if (!success) throw `Error saving settings`
and recalls like this:
//recall settings (goes in the script that needs to use the settings)
let recallSettings = sf.file.readJson({
path: sf.soundflow.thisPackage.getDirectory().path + '/savedClipSettings.json'
}).json
let {clipName, setting_two, setting_three} = recallSettings;
//log(clipName)
Repeat for versionName, only to a different JSON file.
This code runs much earlier in the main script, and work great as other parts of my script depend on these files and fire perfectly.
So basically, I'm asking Izotope (standalone) to wait while there is a window open that begins with a chunk of the print masters filename being processed at that time. In this case my Broadcast Print, Then when it disappears, to carry open and process my Online Print. But the script doesn't wait, they fire back to back and the thing fails as Izotope can't do both at once.
p.s. I've also tried "sf.ui.izotope.floatingWindow.whoseTitle.startsWith(${processPath}
).exists ||" without luck.
So, brilliant humans, what am I doing wrong? Or how can I think about this differently?
macOS Monterey. M1
Izotope RX 9.3.0 (running latest Native Apple Silicon Standalone version, not Intel)
PT 2022.4 Ultimate
Thanks!
- BBrian Mullany @Brian_Mullany
I found a very, very dirty workaround. So something about Izotope is not communicating with Soundflow, the UI elements are just behaving in a strange way. So I needed to find some other kind of event at a very basic level to use as a trigger to start the second half of my script, since waiting for the processing dialog window to disappear wasn't working.
sf.ui.proTools.appActivateMainWindow(); sf.ui.izotope.mainWindow.elementWaitFor({ waitType: "Appear", });
All that does it tab back to ProTools, while Izotope processes in the background. Then, luckily, when Izotope finishes processing, it steals attention and comes to the foreground. At this point the mainWindow element "Appears" and the script then continues.
- In reply toBrian_Mullany⬆:Kitch Membery @Kitch2022-05-16 17:49:21.018Z
Hi @Brian_Mullany,
Waiting for the iZotope RX "Task Process View" to appear and then disappear, can be tricky.
I've had success with the following script;
//Delay needed to wait for the iZotope "Task Progress View" to appear sf.wait({ intervalMs: 500 }); //Wait for "Task Progress View" to disappear sf.ui.izotope.windows.first.groups.whoseDescription.is("Task Progress View").first.elementWaitFor({ waitType: "Disappear", timeout: -1, // Press "Control + Shift + Esc" to cancel if the script fails; });
I hope that helps. :-)
- BIn reply toBrian_Mullany⬆:Brian Mullany @Brian_Mullany
Will report back in the AM :) Thanks Kitch!
- BIn reply toBrian_Mullany⬆:Brian Mullany @Brian_Mullany
This works you legend. Thanks!
p.s. Enjoy your tuts on YT, very good teacher. I'm sure I'll be back with more
Here is the script running. AS I get better I will streamline the code, and make it more flexible. To run, I click on the video file reference and then hit my shortcut. It assumes the film is mixed to EBU-R128, and Izotope has predefined processing shortcuts, so this isn't quite perfect integration with SF packages, but works in my particular use case, on my machine and with my workflow. Happy to share any code if someone wants to build their own
Kitch Membery @Kitch2022-05-17 17:52:39.356Z
Fantastic work @Brian_Mullany. Love it!
Be sure to join in on one of our weekly hangouts, sometime... https://soundflow.org/hangout