No internet connection
  1. Home
  2. How to

Confirmation Dialog scripts need to be changed

By Jack Green @Jack_Green
    2024-10-08 12:33:09.895Z

    Just wondering if there is any general advice here as I'm ripping my hair out and don't have time to go through and redo lots of my scripts again right now.

    I had todo a complete reset of my machine recently (wiped my hard drive and installed everything from scratch) as I was having performance issues. My machine wouldn't run sessions when colleagues machines ran them perfectly. So terrible 24 hrs of trying to install everything and be back up and running but it fixed the issues I was having great!

    My problem now is that since doing that sound flow has become incredibly unreliable. Scripts that were solid before now just not working.

    It seems like everything is moving too fast. For example 1 of my issues which I have now resolved was on a batch renaming script I have the first action recalls the factory default setting. The script was hitting recall and populating values within the window before the setting had recalled. Adding a small wait (100ms) after the recall fixed the issue in this case but there are lots of similar problems.

    Another issue I'm having is simply clicking OK in a confirmation dialogue. Ive fixed it with the below code for now but it's missing every time. (I have the appropriate Waits in for the element to appear etc)

        try {
            sf.ui.proTools.confirmationDialog.buttons.whoseTitle.is("OK").first.elementClick();
        }
        catch (err) {
            log("Missed Button Pressing Enter")
            sf.keyboard.press({ keys: "enter" })
        }
        sf.ui.proTools.confirmationDialog.elementWaitFor({ waitType: "Disappear" });
    

    Thanks in advance in the middle of a bunch of projects right now and it's all causing me lots of issues. The people I work with are using the same scripts on the same model of machines and not having issues. They are on a previous OS I updated to 14.7 as part of the reset (kinda by accident) Rest of the team are on 13.6.7

    I didn't know if there was something I needed todo for 14.7?

    Thanks in advance!!

    • 11 replies
    1. Jack Green @Jack_Green
        2024-10-08 12:57:20.731Z

        Another Example.

        Modify group window making changes to the wrong group. adding the wait below fixed it.

             sf.ui.proTools.windows.whoseTitle.is("Modify Groups").first.popupButtons.first.popupMenuSelect({ menuPath: vcaGroupPath[0].path })
                        sf.wait({intervalMs:100})
                        sf.ui.proTools.windows.whoseTitle.is("Modify Groups").first.textFields.first.elementSetTextFieldWithAreaValue({ value: "/" + newStemsNeeded[count] });
                        sf.ui.proTools.windows.whoseTitle.is("Modify Groups").first.buttons.whoseTitle.is("OK").first.elementClick();
                        sf.ui.proTools.windows.whoseTitle.is("Modify Groups").first.elementWaitFor({ waitType: "Disappear" });
        

        I was always put off using wait intervals preferring to wait for UI elements etc but I can't find another way round it at the moment ?

        1. In reply toJack_Green:

          There is an issue with PT and confirmation dialogs. Due to changes in Sonoma PT has to handle menu calls in a different manner and in addition, confirmation dialogs throw up a hidden blank window. The SF api at the moment looks for a window with no title when it expects to see a confirmation window but sees the untitled blank window first which will cause some scripts to fail.
          There should be an alternate way to check for a confirmation window coming in the next SF update but in the meantime you could use this piece of code which checks for an untitled / confirmation window that contains an OK button:

          const confirmationWindow = () => sf.ui.proTools.confirmationDialog;
          sf.waitFor({
              callback: () => {
                  confirmationWindow().invalidate();
                  return confirmationWindow().buttons.whoseTitle.is("OK").first.exists;
              },
              timeout: 1000
          }, `Failed waiting for the confirmation dialog`);
          

          Adding sf.wait calls before waiting for a confirmation dialog as you've done works but the above code is much more robust.

          1. Use the above code instead of sf.ui.proTools.confirmationDialog.elementWaitFor()

            1. Jack Green @Jack_Green
                2024-10-08 14:12:41.905Z

                Im guessing I can just put that into a function and use repeatedly?

                1. I don't see why not :).

                  1. Jack Green @Jack_Green
                      2024-10-08 14:15:19.228Z

                      Will using the above code cause issue for people still on 13.XX ?

                      thanks for all you help as always Chris.

                      1. I'm on OS 13.6.7 and I 'm using it with no issues.

                        1. Jack Green @Jack_Green
                            2024-10-08 14:41:39.478Z

                            Are there any other known issues in 14.XX?

                            I'll have a search of the forum now.

                            1. The only known issue to look out for is when you use back to back menu or popup menu calls.
                              If your script fails when doing this use the above sf.waitfor command to check that the menu click has completed (usually by checking if a value changed as a result) before issuing another menu call.
                              This is a generalized description of the issue so if you run into problems just ask on the forum for any help

                              1. Jack Green @Jack_Green
                                  2024-10-08 15:41:02.765Z

                                  Yes I think I'm having this issue too.

                                  I'll have a look into that tomorrow.

                  2. In reply toJack_Green:

                    Hi Jack,

                    We are introducing a new property in SoundFlow 5.9 that deals with this: sf.ui.proTools.confirmationButtonDialog. This one will take care of the problem you're seeing here. Unfortunately, the reason this all happens is that later Pro Tools versions create hidden windows that resemble the confirmation dialog from a scripting perspective, so the code in your script ends up finding the wrong window and then can't press OK on it.
                    Chris' code is another way to fix this, so you can use that or the new property when 5.9 is released - they'll work more or less identically.