No internet connection
  1. Home
  2. Script Sharing

Wait For Bounce Dialog to Complete Code

By Needlew @needlew
    2026-10-28 11:02:27.072Z2026-10-28 11:17:19.581Z

    Hey all,

    I had the same issue like Andrew here: Waiting for the bounce to complete and differentiate between a successful and a canceled bounce. As I didn't find anything in the forum, this is the solution I came up with, maybe it helps (:

    var success = false;
    const bounceDialogue = sf.ui.proTools.windows.whoseTitle.is("Bounce Mix").first;
    bounceDialogue.elementWaitFor({waitType: "Disappear", timeout: -1});
    
    const mainWindow = sf.ui.proTools.mainWindow;
    const audioImportDialogue = sf.ui.proTools.windows.whoseTitle.is("Audio Import Options").first;
    var mainWindowIsFocused = false;
    var audioImportDialogueExists = false;
    while (!mainWindowIsFocused && !audioImportDialogueExists) {
        sf.wait({intervalMs: 1000});
        mainWindowIsFocused = mainWindow.invalidate().isFocused;
        audioImportDialogueExists = audioImportDialogue.invalidate().exists;
    }
    
    sf.wait({intervalMs: 200}); //these two lines are only for whyever PT may decide to focus 
    audioImportDialogueExists = audioImportDialogue.exists; //to mainWindow in between the bounce progress and the audioImportWindow
    if (audioImportDialogueExists)
        success = true;
    
    return success
    

    I tested this on a few successful and canceled bounces. I also stopped the time and didn't find an impact worth mentioning.

    The excerpt of a script regularly checks for the mainWindow to focus or the audioImportWindow to exists. If one of the status occurs, the while loop is exited. If the audioImportWindow is open after the bounce progress isn't visible, the bounce finished with success. If the audioImportWindow isn't open after the progress bar isn't visible, the bounce was canceled and thus success stays false.
    WaitForNoModals() won't work, as it "ignores" the canceled bounce.

    If there are any suggestions/refactoring ideas, please let me know!

    All the best,
    Paul

    • 0 replies