No internet connection
  1. Home
  2. How to

Trigger a switch Deck command via window close

By Micah Loken @Micah_Loken
    2022-02-24 03:02:48.159Z

    Is there currently a way to switch decks based on a window being closed in Pro Tools? I have looked around and the closest I have found is the other way around when you focus/activate a window that could trigger a Deck to show.

    Example:

    When the Color Palette window in Pro Tools is opened, a deck is shown on my stream deck device. This part is easy.

    When the Color Palette window in Pro Tools is closed (either manually via click, manually via hotkey, or automated via script), the deck is closed and switched back to the main PT Deck.

    Thanks!

    Solved in post #6, click to view
    • 30 replies

    There are 30 replies. Estimated reading time: 83 minutes

    1. Hi Micah,

      You should be able to trigger this based on the Edit (main) window being focused using a window trigger where you use "contains" and set that to "Edit: "

      1. In reply toMicah_Loken:
        Kitch Membery @Kitch2022-02-24 19:32:46.630Z

        Hi @Micah_Loken,

        As Christian mentioned, a Window trigger assigned to the main Pro Tools deck should do the trick :-)

        Setup like this;

        1. MMicah Loken @Micah_Loken
            2022-02-24 21:17:35.093Z2022-02-25 01:13:58.220Z

            Thank you for your replies @Kitch & @chrscheuer. The problem with switching to the main PT Deck whenever the 'Edit' window is focussed, is that it negates a possible task that I am attempting.

            For an example, if I have the color palette window focussed (which triggers opening my color palette deck), then I click anywhere on the edit window (example: I select a region/clip on the timeline to color), the deck will switch back to the main PT Deck which is counter to what I am attempting to achieve. Thus, I am unable to use the "When a window titled 'Edit' is focused" trigger for my main PT deck.

            Here is the main problem. My current trigger for my PT deck is "When Pro Tools becomes active" That works fine when switching applications away from PT and then coming back. It works like a charm! The issue mainly arrises when I use my command from iZotope RX to send back to PT from iZotope's standalone app to PT, the deck does not switch back to PT even though PT has become active.

            I have tried two different commands.

            sf.keyboard.press({
                keys: "cmd+return",
            });
            

            and

            var shuttleBtn = sf.ui.izotope.mainWindow.children.whoseDescription.endsWith('Main Window').first.children.whoseDescription.is("Shuttle").first;
            shuttleBtn.elementClick({}, "Could not click Send Back button");
            

            Both of which not yielding the results I am hoping for.

            There is likely a very discrepant script mixed with my deck switching shenanigans going on and it's almost certainly a user error sort of situation. Would you mind taking a look at my code and advising me on cleanup?

            Here is the "Send back to PT (From iZotope standalone app)" script I have:

            
            //I've tried this as well and it didn't yield the result I was hoping for either
            /*
            sf.keyboard.press({
                keys: "cmd+return",
            });
            */
            
            
            var shuttleBtn = sf.ui.izotope.mainWindow.children.whoseDescription.endsWith('Main Window').first.children.whoseDescription.is("Shuttle").first;
            shuttleBtn.elementClick({}, "Could not click Send Back button");
            
            //It is very possible that this is the culprit that is not allowing the application focus to operate as desired when sending back to PT, but I need it to wait until the dialogue box disappears or at least wait until Pro Tools comes into focus. Will that help to change the script to wait for PT to focus before proceeding?
            sf.ui.izotope.floatingWindows.whoseTitle.startsWith("Pro Tools").first.elementWaitFor({
                waitType: "Disappear",
                timeout: 20000,
            });
            
            sf.wait({
                intervalMs: 500,
            });
            
            //Activate the main Pro Tools window - I've tried both of these
            sf.ui.proTools.appActivateMainWindow();
            //sf.ui.proTools.invalidate().appActivateMainWindow();
            
            sf.wait({
                intervalMs: 200,
            });
            
            var names = [
                'RX 9 Connect',
                'RX 8 Connect',
                'RX 7 Connect',
                'RX 6 Connect',
                'RX 5 Connect',
            ];
            
            
            let win;
            
            
            for (let name of names) {
                win = sf.ui.proTools.getAudioSuiteWindow(name);
                if (win && win.exists) break;
            
                if (!win || !win.exists) {
                    throw "The RX Connect AudioSuite window is closed or not found. Please reopen and try again.";
                }
            
            }
            
            sf.ui.proTools.firstAudioSuiteWindow.buttons.whoseTitle.is('Render').first.elementClick();
            
            sf.wait({
                intervalMs: 200,
            });
            
            
            const colorPaletteWin = sf.ui.proTools.colorPaletteWindow;
            
            if (colorPaletteWin && colorPaletteWin.exists) {
            
                sf.ui.proTools.colorsSelect({
                    colorTarget: "ClipsInTracks",
                    colorBrightness: "Medium",
                    colorNumber: 20,
                });
            
            } else {
            
                sf.ui.proTools.colorsShowWindow();
            
                colorPaletteWin.elementWaitFor();
            
                sf.ui.proTools.colorsSelect({
                    colorTarget: "ClipsInTracks",
                    colorBrightness: "Medium",
                    colorNumber: 20,
                });
            
                sf.wait({
                    intervalMs: 300,
                });
            
                colorPaletteWin.windowClose();
            
                colorPaletteWin.elementWaitFor({ waitType: 'Disappear' });
            
            };
            
            
            //Activate the main Pro Tools window - I've tried both of these
            sf.ui.proTools.appActivateMainWindow();
            //sf.ui.proTools.invalidate().appActivateMainWindow();
            
            sf.wait({
                intervalMs: 200,
            });
            
            sf.decks.get('user:default:cku6k9r2l0000lu10a8we29rx').showOnStreamDeck({
                device: sf.devices.streamDeck.getDeviceBySerialNumber('MY DECK'S SERIAL NUMBER'),
            });
            
            
            //I've also attempted this 'open' command as well and it hasn't worked
            /*
            sf.decks.get('user:default:cku6k9r2l0000lu10a8we29rx').open({
                device: sf.devices.streamDeck.getDeviceBySerialNumber('MY DECK'S SERIAL NUMBER'),
                openMode: "OpenExisting",
            });
            */
            
            
            

            The problem at the end is that the stream deck blinks my PT Deck but then goes back to the color palette deck and stalls out. I believe this has something to do with the fact that my Color Palette Deck is set to show when the color palette window is opened.

            The problem here is, when the color palette window is closed by the executed script, I can't seem to figure out how to switch back to the main PT Deck as it forces the color palette deck to stay open.

            Any help would be much appreciated. Thanks!

            1. In reply toKitch:
              MMicah Loken @Micah_Loken
                2022-02-26 01:25:04.434Z

                @Kitch and @chrscheuer, let me know if you would prefer I post this code somewhere else. I am new to the forums and the SF App. Thanks!

                1. Kitch Membery @Kitch2022-02-26 02:03:28.813Z2022-03-03 07:40:15.461Z

                  Hi @Micah_Loken,

                  With the first scenario regarding the Color Palette deck / Pro Tools Deck. This sort of functionality would require a run-forever script, AFAIK this is because the operating system does not let SoundFlow know when the Color Palette window loses focus.

                  You would have to create a script that runs in the background checking to see if the color palette window is open or closed, similar to this;

                  const proToolsDeckId = "user:cl01px8qp0007k310xe76wx64:cl01pxt5w000ak310arxsjapv";
                  const deviceId = "mobile.CDB651B5-0ADE-4456-A8E5-286C1F1E66C0--Kitch_s-iPhone";
                  
                  let isColorPaletteWindowOpen = sf.ui.proTools.colorPaletteWindow.exists;
                  
                  function main() {
                      //sf.ui.proTools.invalidate();
                  
                      if (isColorPaletteWindowOpen !== sf.ui.proTools.colorPaletteWindow.invalidate().exists) {
                  
                          let colorPaletteWindow = sf.ui.proTools.colorPaletteWindow;
                  
                          if (!colorPaletteWindow.exists) {
                              sf.decks.get(proToolsDeckId).open({
                                  device: sf.devices.mobile.getByDeviceId(deviceId),
                              });
                          }
                  
                          //log("changed")
                  
                          isColorPaletteWindowOpen = sf.ui.proTools.colorPaletteWindow.exists;
                      }
                  }
                  
                  function runForever(name, action, interval, timeout) {
                      var now = (new Date).valueOf();
                      if (now - globalState[name] < timeout) throw 0; //Exit if we were invoked again inside the timeout
                  
                      globalState[name] = now;
                      sf.engine.runInBackground(function () {
                          try {
                              while (true) {
                                  sf.engine.checkForCancellation();
                  
                                  // "action()" Triggers the "main" function every 500ms
                                  action()
                  
                                  sf.wait({ intervalMs: interval, executionMode: 'Background' });
                              }
                          } finally {
                              globalState[name] = null;
                          }
                      });
                  }
                  
                  runForever("followTrackName", main, 100, 5000);
                  

                  You'd then replace the following code;

                              sf.decks.get(proToolsDeckId).open({
                                  device: sf.devices.mobile.getByDeviceId(deviceId),
                              });
                  

                  ...With the code of either the "Show Deck on Stream Deck" or the "Open Deck (Show on Device)" macro actions.

                  Note: You would still have the Window Trigger assigned to the Color Palette Deck as you did before. And this script would need to have a Pro Tools Application Trigger set to active.

                  Is there a reason you need the Color Window to be controlling the deck visibility? I only ask as the Pro Tools package Color presets already open the window for you if it's not open already. Simply having a button to open your color palette deck would be a more robust solution.

                  I hope this helps. Let me know if this all makes sense or if you need further clarification.

                  Rock on!

                  UPDATED Script so that the run-forever script does not blow up the log.

                  ReplySolution
                  1. MMicah Loken @Micah_Loken
                      2022-03-03 06:34:48.438Z

                      Hey Kitch,

                      So, I noticed something was being a bit whacky and then checked the main log file and it is 409MB large in just a few hours. I closed Pro Tools but the run forever script was still running and I have the trigger set to run when PT becomes active. Is there a way to stop the trigger when PT is inactive or the application is closed?

                      1. Kitch Membery @Kitch2022-03-03 07:07:15.398Z

                        Hi Micah_Loken,

                        This seems odd that the log file is getting that large. Let me take a look at your account when I get a moment.

                        For now, best to remove any trigger attached to the run-forever script (or any macro launching the run-forever script), and then Quit SoundFlow from the SoundFlow Icon up by the clock and then restart SoundFlow from your applications folder.

                        Also I posed a question in my last post... Is there a reason you need the Color Window to be controlling the deck visibility? I only ask as the Pro Tools package Color presets already open the color palette window for you if it's not open already. Simply having a button to open your color palette deck would be a more robust solution. Have you considered this solution instead?

                        Rock on!

                        1. MMicah Loken @Micah_Loken
                            2022-03-03 07:54:57.703Z

                            @Kitch - I am creating a color deck that has more than color in it and need to be able to access other items within folders while working with the color palette. It's a specific method that is unique to my workflow.

                            Regarding your script, it is interesting because as I am running other scripts that have "throw" commands in them, often this will occur when a throw command is on the screen, even when I have the Pro Tools Application completely closed:

                            My gut tells me the run forever script is still attempting to run even when Pro Tools application is not open. The trigger I have on the run forever script is "When Pro Tools becomes active" but there is no script that I understand which is telling it to stop attempting to find the color palette once the application is closed. The run forever script is totally over my head other than the general understanding of what it is doing, beyond that the javascript is well above my pay grade. :)

                            Here is my script as a reference:

                            
                            const proToolsDeckId = "user:default:cku6k9r2l0000lu10a8we29rx";
                            const deviceId = "streamDeckHid.CL37K1A00965.a1a48a30-80e2-44be-870a-0d5a3a984e7a";
                            
                            let isColorPaletteWindowOpen = sf.ui.proTools.colorPaletteWindow.exists;
                            
                            function main() {
                                sf.ui.proTools.invalidate();
                            
                                if (isColorPaletteWindowOpen !== sf.ui.proTools.colorPaletteWindow.exists) {
                            
                                    let colorPaletteWindow = sf.ui.proTools.colorPaletteWindow;
                            
                                    if (!colorPaletteWindow.exists) {
                                        sf.decks.get('user:default:cku6k9r2l0000lu10a8we29rx').showOnStreamDeck({
                                            device: sf.devices.streamDeck.getDeviceBySerialNumber('CL37K1A00965'),
                                        });
                            
                                    }
                            
                                    //log("changed")
                            
                                    isColorPaletteWindowOpen = sf.ui.proTools.colorPaletteWindow.exists;
                                }
                            }
                            
                            function runForever(name, action, interval, timeout) {
                                var now = (new Date).valueOf();
                                if (now - globalState[name] < timeout) throw 0; //Exit if we were invoked again inside the timeout
                            
                                globalState[name] = now;
                                sf.engine.runInBackground(function () {
                                    try {
                                        while (true) {
                                            sf.engine.checkForCancellation();
                            
                                            // "action()" Triggers the "main" function every 500ms
                                            action()
                            
                                            sf.wait({ intervalMs: interval, executionMode: 'Background' });
                                        }
                                    } finally {
                                        globalState[name] = null;
                                    }
                                });
                            }
                            
                            runForever("followTrackName", main, 100, 5000);
                            

                            NOTE: The error message in the image I attached for "Error: the operation was canceled. Check for Color Palette in background Line 32" is this line in the code:

                                sf.engine.runInBackground(function () {
                            

                            Hope this helps!

                            1. In reply toKitch:
                              MMicah Loken @Micah_Loken
                                2022-03-03 08:03:32.073Z

                                @Kitch - on a more detailed glance of my massive log file, I found this is where it started (after I activated Pro Tools and it ran the forever script):

                                02.03.2022 11:34:06.45 <info> [Backend]: #App: Activate "com.avid.ProTools" -> My Pro Tools Deck [ckzpy2med0001ai10qdrjd4of]
                                
                                02.03.2022 11:34:06.45 <info> [Backend]: #App: Activate "com.avid.ProTools" -> Check for Color Palette in background [cl09wnhdo0002pg10vlclq93m]
                                [AxDeckInstance] InstanceShow: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.f929b60d-cd65-4f1f-ac10-c955098fe855 (My Pro Tools Deck) Device: 'CL37K1A00965'
                                [AxDeckInstance] TriggerDraw: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.f929b60d-cd65-4f1f-ac10-c955098fe855 (My Pro Tools Deck) Device: 'CL37K1A00965'
                                [AxStreamDeckDevice] Device 'CL37K1A00965' -> ShowDeckInstance: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.f929b60d-cd65-4f1f-ac10-c955098fe855
                                
                                02.03.2022 11:34:06.45 <info> [Backend]: [AxStreamDeckDevice] DrawInstance. instance 'user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.f929b60d-cd65-4f1f-ac10-c955098fe855'
                                
                                02.03.2022 11:34:06.46 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                
                                02.03.2022 11:34:06.46 <info> [Backend]: ProTools version: 21.12.0.97 class: PT2021_6
                                ProTools processID: 2965
                                AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                
                                02.03.2022 11:34:06.56 <info> [Backend]: ProTools version: 21.12.0.97 class: PT2021_6
                                ProTools processID: 2965
                                
                                02.03.2022 11:34:06.56 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                
                                02.03.2022 11:34:06.67 <info> [Backend]: ProTools version: 21.12.0.97 class: PT2021_6
                                ProTools processID: 2965
                                
                                02.03.2022 11:34:06.67 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                
                                02.03.2022 11:34:06.77 <info> [Backend]: ProTools version: 21.12.0.97 class: PT2021_6
                                ProTools processID: 2965
                                
                                02.03.2022 11:34:06.77 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                
                                02.03.2022 11:34:06.87 <info> [Backend]: ProTools version: 21.12.0.97 class: PT2021_6
                                ProTools processID: 2965
                                
                                02.03.2022 11:34:06.87 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                
                                02.03.2022 11:34:06.98 <info> [Backend]: ProTools version: 21.12.0.97 class: PT2021_6
                                ProTools processID: 2965
                                
                                02.03.2022 11:34:06.98 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                
                                02.03.2022 11:34:07.08 <info> [Backend]: ProTools version: 21.12.0.97 class: PT2021_6
                                ProTools processID: 2965
                                
                                
                                

                                There are thousands of instances of this listed over and over again:

                                02.03.2022 11:34:18.59 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                
                                02.03.2022 11:34:18.69 <info> [Backend]: ProTools version: 21.12.0.97 class: PT2021_6
                                ProTools processID: 2965
                                

                                Fun times!

                                1. Kitch Membery @Kitch2022-03-03 08:05:49.802Z

                                  Hi @Micah_Loken,

                                  I'm writing a reply right now regarding this issue. I've updated the run-forever script above removing the Pro Tools invalidation that is causing the log to blow up.

                                  Stand by :-)

                                2. In reply toKitch:
                                  Kitch Membery @Kitch2022-03-03 08:10:09.987Z

                                  Hi again @Micah_Loken,

                                  Lets see if we can work it out :-)

                                  I took a look at the run-forever script that I had written, and I realized that the sf.ui.proTools.invalidate(); code in the main function was causing the log to blow up with the following line every 100ms.

                                  02.03.2022 23:26:01.07 <info> [Backend]: ProTools version: 21.12.0.97 class: PT2021_6
                                  ProTools processID: 11781
                                  
                                  02.03.2022 23:26:01.14 <info> [Backend]: ProTools version: 21.12.0.97 class: PT2021_6
                                  ProTools processID: 11781
                                  
                                  etc...
                                  

                                  EEEEKKKK. My apologies, I did not realize that would happen;

                                  I've updated the run-forever script in the prior post, which will stop the log from bloating.

                                  So all up, you should have;

                                  2 decks

                                  • Your "Pro Tools" Deck - (Add an Application Trigger for when Pro Tools becomes active)
                                  • Your "Color" Deck - (No trigger needed)
                                    For each Deck, make sure you set the "Device" property to your stream deck.

                                  2 Scripts

                                  • "Show Pro Tools Deck" Run-forever Script, (Add an Application Trigger for when Pro Tools becomes active)
                                  • "Show Color Deck" Script (Add a Window Trigger for the Window Title: "Color Palette" )

                                  Let me know how you go with it.
                                  Kitch

                                  1. MMicah Loken @Micah_Loken
                                      2022-03-03 08:15:16.619Z

                                      @Kitch - Sorry for writing over your messages as you were sending me a response. I guess my page hadn't updated your responses yet.

                                      Thanks! I'll give it a go when I have some time tomorrow. I wanted to bring this up since it was bogging down my system. Regarding the color palette script, I already have that set up and been using it, now to implement your new runForever script. Again, thank you for your help with all of this. I'll keep you posted.

                                      1. Kitch Membery @Kitch2022-03-03 08:21:08.734Z

                                        My pleasure, Micah, Fingers crossed It works as expected.

                                        Keep me posted. :-)

                                        1. MMicah Loken @Micah_Loken
                                            2022-03-03 20:01:08.702Z

                                            @Kitch - This is working much better!

                                            After running your updated version, everything seems to be ok except when Pro Tools is launching.

                                            Here is the log:

                                            03.03.2022 11:50:22.02 <info> [Backend]: #StreamDeck: KeyDown (2,1) -> Open Pro Tools
                                            
                                            03.03.2022 11:50:22.02 <info> [Backend]: >> Command: Open Pro Tools [user:default:cky4j239y0002c810d0ldzpyp]
                                            
                                            03.03.2022 11:50:22.09 <info> [Backend]: << Command: Open Pro Tools [user:default:cky4j239y0002c810d0ldzpyp]
                                            
                                            03.03.2022 11:50:22.76 <info> [Backend]: [SF_FIREBASE_WS]: Sending keep-alive
                                            
                                            03.03.2022 11:50:24.62 <info> [Backend]: ProTools version: 21.12.0.97 class: PT2021_6
                                            ProTools processID: 15697
                                            
                                            03.03.2022 11:50:24.62 <info> [Backend]: ProTools version: 21.12.0.97 class: PT2021_6
                                            ProTools processID: 15697
                                            
                                            03.03.2022 11:50:24.63 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:26.41 <info> [Backend]: #App: Activate "com.avid.ProTools" -> My Pro Tools Deck [ckzpy2med0001ai10qdrjd4of]
                                            
                                            03.03.2022 11:50:26.41 <info> [Backend]: #App: Activate "com.avid.ProTools" -> Check for Color Palette in background [cl0be8lwk0002aw10kum7opfb]
                                            [AxDeckInstance] InstanceShow: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.fd0b31d2-e8cf-4bdd-a401-2b64ed893f0b (My Pro Tools Deck) Device: 'CL37K1A00965'
                                            
                                            03.03.2022 11:50:26.41 <info> [Backend]: [AxDeckInstance] TriggerDraw: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.fd0b31d2-e8cf-4bdd-a401-2b64ed893f0b (My Pro Tools Deck) Device: 'CL37K1A00965'
                                            [AxStreamDeckDevice] Device 'CL37K1A00965' -> ShowDeckInstance: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.fd0b31d2-e8cf-4bdd-a401-2b64ed893f0b
                                            [AxStreamDeckDevice] DrawInstance. instance 'user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.fd0b31d2-e8cf-4bdd-a401-2b64ed893f0b'
                                            
                                            03.03.2022 11:50:26.42 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:26.43 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:26.53 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:26.63 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:26.74 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:26.84 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:26.94 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:27.04 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:27.15 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:27.25 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:27.35 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:27.46 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:27.56 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:27.66 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:27.77 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:27.87 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:27.98 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:28.08 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:28.18 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:28.28 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:28.39 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:28.49 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:28.59 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:28.70 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:28.80 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:28.90 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:29.01 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:29.11 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:29.22 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:29.32 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:29.43 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:29.53 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:29.63 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:29.74 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:29.84 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:29.94 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:30.11 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:30.22 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:30.32 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:30.42 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:30.52 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:30.63 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:30.73 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:30.83 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:30.94 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:31.04 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:31.14 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:31.24 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:31.35 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:31.45 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:31.55 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:31.65 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:31.76 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:31.86 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:31.97 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:32.07 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:32.17 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:32.28 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:32.38 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:32.48 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:32.58 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:32.69 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:32.79 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:32.89 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:32.100 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:33.10 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:33.20 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:33.31 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:33.41 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:33.51 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:33.62 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:33.72 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:33.82 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:33.93 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:34.03 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:34.13 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:34.24 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:34.34 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:34.44 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:34.55 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:34.64 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:34.65 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:34.75 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:34.86 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:34.96 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:35.06 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:35.17 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:35.27 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:35.38 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:35.48 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:35.58 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:35.68 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:35.79 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:35.89 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:35.99 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:36.10 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:36.20 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:36.30 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:36.41 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:36.51 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:36.62 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:36.72 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:36.82 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:36.92 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:37.03 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:37.13 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:37.24 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:37.34 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:37.44 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:37.55 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:37.65 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:37.75 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:37.85 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:37.96 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:38.06 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:38.16 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:38.27 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:38.37 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:38.48 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:38.58 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:38.69 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:38.79 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:38.89 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:38.99 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:39.10 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:39.20 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:39.30 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:50:56.06 <info> [Backend]: AXUIElementException in LoadUIElement: kAXErrorCannotComplete
                                            
                                            03.03.2022 11:51:07.77 <info> [Backend]: [SF_FIREBASE_WS]: Sending keep-alive
                                            

                                            It seems to be trying to find an instance of color palette or not and getting confused as the application is opening. Not as big of a deal because the rest of it seems to be working as it should. Thoughts?

                                            1. Kitch Membery @Kitch2022-03-03 20:04:44.259Z

                                              Hi @Micah,

                                              I'll take a look at this when I have a moment. :-)

                                              1. MMicah Loken @Micah_Loken
                                                  2022-03-04 01:43:21.606Z

                                                  Thanks @Kitch! Much appreciated. Another issue I ran into with the new script is each time Pro Tools is activated, another instance of the runForever script is enacted. So, if I were to switch away to another application and then switch back to PT, SF would start another instance of the runForever script to check for the color palette... which makes sense because we have the trigger set to "When Pro Tools becomes active". I eventually noticed it in the main log after a few hours with multiple instances attached. :)

                                                  1. Kitch Membery @Kitch2022-03-04 02:29:31.877Z

                                                    Hi @Micah_Loken,

                                                    I understand your thought process here, however the way that the run forever script is setup, each time the script is triggered, the runForever function will not run again if invoked inside the timeout. (See the comment //Exit if we were invoked again inside the timeout inside the run-forever script.)

                                                    Be sure you are using the Run-forever script from this thread.

                                                    Whenever you are testing changes to the run forever script, you'll need to "Stop all running commands" before re-triggering it. You can do this either from the SoundFlow menu's second page, pr by using the keyboard shortcut "Control + Shift + Esc"

                                                    1. MMicah Loken @Micah_Loken
                                                        2022-03-04 03:03:55.173Z

                                                        Hey @Kitch,

                                                        Yes, I am definitely using the "Stop All Running Commands" shortcut constantly while testing and running new scripts. :)

                                                        The problem, I have found, is that each time I switch away from Pro Tools to another application, and then come back to PT, a new instance of the runForever script is started and the old one is not stopped.

                                                        To be clear, here is the code I am using from you:

                                                        const proToolsDeckId = "user:cl01px8qp0007k310xe76wx64:cl01pxt5w000ak310arxsjapv";
                                                        const deviceId = "mobile.CDB651B5-0ADE-4456-A8E5-286C1F1E66C0--Kitch_s-iPhone";
                                                        
                                                        let isColorPaletteWindowOpen = sf.ui.proTools.colorPaletteWindow.exists;
                                                        
                                                        function main() {
                                                            //sf.ui.proTools.invalidate();
                                                        
                                                            if (isColorPaletteWindowOpen !== sf.ui.proTools.colorPaletteWindow.invalidate().exists) {
                                                        
                                                                let colorPaletteWindow = sf.ui.proTools.colorPaletteWindow;
                                                        
                                                                if (!colorPaletteWindow.exists) {
                                                                    sf.decks.get(proToolsDeckId).open({
                                                                        device: sf.devices.mobile.getByDeviceId(deviceId),
                                                                    });
                                                                }
                                                        
                                                                //log("changed")
                                                        
                                                                isColorPaletteWindowOpen = sf.ui.proTools.colorPaletteWindow.exists;
                                                            }
                                                        }
                                                        
                                                        function runForever(name, action, interval, timeout) {
                                                            var now = (new Date).valueOf();
                                                            if (now - globalState[name] < timeout) throw 0; //Exit if we were invoked again inside the timeout
                                                        
                                                            globalState[name] = now;
                                                            sf.engine.runInBackground(function () {
                                                                try {
                                                                    while (true) {
                                                                        sf.engine.checkForCancellation();
                                                        
                                                                        // "action()" Triggers the "main" function every 500ms
                                                                        action()
                                                        
                                                                        sf.wait({ intervalMs: interval, executionMode: 'Background' });
                                                                    }
                                                                } finally {
                                                                    globalState[name] = null;
                                                                }
                                                            });
                                                        }
                                                        
                                                        runForever("followTrackName", main, 100, 5000);
                                                        

                                                        and I have replaced the proToolsDeckID with my personal ID and the deviceID with my device's ID, and replaced the following portion of the code with my "Show Deck on Stream Deck" code:

                                                                    sf.decks.get(proToolsDeckId).open({
                                                                        device: sf.devices.mobile.getByDeviceId(deviceId),
                                                                    });
                                                        

                                                        So, now... when I stop all running commands, and activate the main window of PT, and open the color palette window, then close the color palette window, here is what happens:

                                                        03.03.2022 18:54:45.03 <info> [Backend]: #App: Activate "com.avid.ProTools" -> My Pro Tools Deck [ckzpy2med0001ai10qdrjd4of]
                                                        
                                                        03.03.2022 18:54:45.03 <info> [Backend]: #App: Activate "com.avid.ProTools" -> Check for Color Palette in background [cl0be8lwk0002aw10kum7opfb]
                                                        
                                                        03.03.2022 18:54:45.03 <info> [Backend]: [AxDeckInstance] InstanceShow: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.c7a62829-5840-41c1-8933-1cc1815dffde (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        [AxDeckInstance] TriggerDraw: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.c7a62829-5840-41c1-8933-1cc1815dffde (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        [AxStreamDeckDevice] Device 'CL37K1A00965' -> ShowDeckInstance: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.c7a62829-5840-41c1-8933-1cc1815dffde
                                                        [AxStreamDeckDevice] DrawInstance. instance 'user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.c7a62829-5840-41c1-8933-1cc1815dffde'
                                                        
                                                        03.03.2022 18:54:46.94 <info> [Backend]: #StreamDeck: KeyDown (3,2) -> Open Color Palette
                                                        
                                                        03.03.2022 18:54:46.94 <info> [Backend]: >> Command: Open Color Palette [user:default:ckzzq7qe9000e7910heo0ddcj]
                                                        Showing Deck "PT Color Palette Deck" on Device "Micah Loken's Deck" (We were called with device "Micah Loken's Deck")
                                                        [AxDeckInstance] InstanceShow: user:default:ckzyyq9vb000a791002l439mg:streamDeckHid.CL37K1A00965.c360b13a-2d8c-4d79-920d-e013bc27d6b1 (PT Color Palette Deck) Device: 'CL37K1A00965'
                                                        [AxDeckInstance] TriggerDraw: user:default:ckzyyq9vb000a791002l439mg:streamDeckHid.CL37K1A00965.c360b13a-2d8c-4d79-920d-e013bc27d6b1 (PT Color Palette Deck) Device: 'CL37K1A00965'
                                                        [AxStreamDeckDevice] Device 'CL37K1A00965' -> ShowDeckInstance: user:default:ckzyyq9vb000a791002l439mg:streamDeckHid.CL37K1A00965.c360b13a-2d8c-4d79-920d-e013bc27d6b1
                                                        
                                                        03.03.2022 18:54:46.95 <info> [Backend]: [AxStreamDeckDevice] DrawInstance. instance 'user:default:ckzyyq9vb000a791002l439mg:streamDeckHid.CL37K1A00965.c360b13a-2d8c-4d79-920d-e013bc27d6b1'
                                                        ProTools version: 21.12.0.97 class: PT2021_6
                                                        ProTools processID: 15697
                                                        Checking for running apps with bundle 'com.avid.ProTools'
                                                        NSArray.ArrayFromHandle count = 1
                                                        
                                                        03.03.2022 18:54:46.97 <info> [Backend]: ProTools version: 21.12.0.97 class: PT2021_6
                                                        ProTools processID: 15697
                                                        
                                                        03.03.2022 18:54:47.03 <info> [Backend]: Mouse current pos is: (1757.6639404296875, 745.83984375)
                                                        Clicking with mouse here: (72, 32)
                                                        
                                                        03.03.2022 18:54:47.04 <info> [Backend]: Moving mouse back to: (1757.6639404296875, 745.83984375)
                                                        
                                                        03.03.2022 18:54:47.04 <info> [Backend]: Position is now: (1757.6639404296875, 745.83984375)
                                                        
                                                        03.03.2022 18:54:47.27 <info> [Backend]: Mouse current pos is: (1757.6639404296875, 745.83984375)
                                                        Clicking with mouse here: (1824, 93)
                                                        
                                                        03.03.2022 18:54:47.27 <info> [Backend]: Moving mouse back to: (1757.6639404296875, 745.83984375)
                                                        
                                                        03.03.2022 18:54:47.28 <info> [Backend]: Position is now: (1757.6639404296875, 745.83984375)
                                                        
                                                        03.03.2022 18:54:47.28 <info> [Backend]: << Command: Open Color Palette [user:default:ckzzq7qe9000e7910heo0ddcj]
                                                        
                                                        03.03.2022 18:54:52.12 <info> [Backend]: #StreamDeck: KeyDown (1,4) -> Back to PT Deck - Color Palette
                                                        
                                                        03.03.2022 18:54:52.13 <info> [Backend]: >> Command: Back to PT Deck - Color Palette [user:default:ckzzxghim000j7910oundw46v]
                                                        
                                                        03.03.2022 18:54:52.14 <info> [Backend]: << Command: Back to PT Deck - Color Palette [user:default:ckzzxghim000j7910oundw46v]
                                                        
                                                        03.03.2022 18:54:52.24 <info> [Backend]: Showing Deck "My Pro Tools Deck" on Device "Micah Loken's Deck" (We were called with device "Micah Loken's Deck")
                                                        [AxDeckInstance] InstanceShow: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.02e05fe1-2105-41cd-8813-fccda0684aa3 (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        
                                                        03.03.2022 18:54:52.24 <info> [Backend]: [AxDeckInstance] TriggerDraw: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.02e05fe1-2105-41cd-8813-fccda0684aa3 (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        [AxStreamDeckDevice] Device 'CL37K1A00965' -> ShowDeckInstance: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.02e05fe1-2105-41cd-8813-fccda0684aa3
                                                        [AxStreamDeckDevice] DrawInstance. instance 'user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.02e05fe1-2105-41cd-8813-fccda0684aa3'
                                                        
                                                        03.03.2022 18:54:57.00 <info> [Backend]: [SF_FIREBASE_WS]: Sending keep-alive
                                                        
                                                        03.03.2022 18:55:32.55 <info> [Backend]: #App: Activate "com.avid.ProTools" -> My Pro Tools Deck [ckzpy2med0001ai10qdrjd4of]
                                                        
                                                        03.03.2022 18:55:32.55 <info> [Backend]: #App: Activate "com.avid.ProTools" -> Check for Color Palette in background [cl0be8lwk0002aw10kum7opfb]
                                                        [AxDeckInstance] InstanceShow: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.02e05fe1-2105-41cd-8813-fccda0684aa3 (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        [AxDeckInstance] TriggerDraw: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.02e05fe1-2105-41cd-8813-fccda0684aa3 (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        [AxStreamDeckDevice] Device 'CL37K1A00965' -> ShowDeckInstance: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.02e05fe1-2105-41cd-8813-fccda0684aa3
                                                        
                                                        03.03.2022 18:55:32.55 <info> [Backend]: [AxStreamDeckDevice] DrawInstance. instance 'user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.02e05fe1-2105-41cd-8813-fccda0684aa3'
                                                        
                                                        03.03.2022 18:55:42.00 <info> [Backend]: [SF_FIREBASE_WS]: Sending keep-alive
                                                        

                                                        Now, if I switch back and forth from Google Chrome to Pro Tools main windows (as I am typing this) five times back and forth, and then open/close the color palette in PT, here is what happens:

                                                        03.03.2022 18:59:47.72 <info> [Backend]: #App: Activate "com.avid.ProTools" -> My Pro Tools Deck [ckzpy2med0001ai10qdrjd4of]
                                                        
                                                        03.03.2022 18:59:47.72 <info> [Backend]: #App: Activate "com.avid.ProTools" -> Check for Color Palette in background [cl0be8lwk0002aw10kum7opfb]
                                                        
                                                        03.03.2022 18:59:47.97 <info> [Backend]: [AxDeckInstance] InstanceShow: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.d15064ec-565a-4f56-ba0a-3401d0c07663 (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        [AxDeckInstance] TriggerDraw: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.d15064ec-565a-4f56-ba0a-3401d0c07663 (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        [AxStreamDeckDevice] Device 'CL37K1A00965' -> ShowDeckInstance: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.d15064ec-565a-4f56-ba0a-3401d0c07663
                                                        
                                                        03.03.2022 18:59:47.97 <info> [Backend]: [AxStreamDeckDevice] DrawInstance. instance 'user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.d15064ec-565a-4f56-ba0a-3401d0c07663'
                                                        
                                                        03.03.2022 18:59:51.11 <info> [Backend]: #App: Activate "com.avid.ProTools" -> My Pro Tools Deck [ckzpy2med0001ai10qdrjd4of]
                                                        
                                                        03.03.2022 18:59:51.12 <info> [Backend]: #App: Activate "com.avid.ProTools" -> Check for Color Palette in background [cl0be8lwk0002aw10kum7opfb]
                                                        [AxDeckInstance] InstanceShow: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.d15064ec-565a-4f56-ba0a-3401d0c07663 (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        
                                                        03.03.2022 18:59:51.12 <info> [Backend]: [AxDeckInstance] TriggerDraw: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.d15064ec-565a-4f56-ba0a-3401d0c07663 (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        [AxStreamDeckDevice] Device 'CL37K1A00965' -> ShowDeckInstance: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.d15064ec-565a-4f56-ba0a-3401d0c07663
                                                        [AxStreamDeckDevice] DrawInstance. instance 'user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.d15064ec-565a-4f56-ba0a-3401d0c07663'
                                                        
                                                        03.03.2022 18:59:55.35 <info> [Backend]: #StreamDeck: KeyDown (3,2) -> Open Color Palette
                                                        
                                                        03.03.2022 18:59:55.38 <info> [Backend]: >> Command: Open Color Palette [user:default:ckzzq7qe9000e7910heo0ddcj]
                                                        Showing Deck "PT Color Palette Deck" on Device "Micah Loken's Deck" (We were called with device "Micah Loken's Deck")
                                                        [AxDeckInstance] InstanceShow: user:default:ckzyyq9vb000a791002l439mg:streamDeckHid.CL37K1A00965.95ba3489-4190-4706-ac29-03a6ff2a8ccb (PT Color Palette Deck) Device: 'CL37K1A00965'
                                                        [AxDeckInstance] TriggerDraw: user:default:ckzyyq9vb000a791002l439mg:streamDeckHid.CL37K1A00965.95ba3489-4190-4706-ac29-03a6ff2a8ccb (PT Color Palette Deck) Device: 'CL37K1A00965'
                                                        [AxStreamDeckDevice] Device 'CL37K1A00965' -> ShowDeckInstance: user:default:ckzyyq9vb000a791002l439mg:streamDeckHid.CL37K1A00965.95ba3489-4190-4706-ac29-03a6ff2a8ccb
                                                        [AxStreamDeckDevice] DrawInstance. instance 'user:default:ckzyyq9vb000a791002l439mg:streamDeckHid.CL37K1A00965.95ba3489-4190-4706-ac29-03a6ff2a8ccb'
                                                        ProTools version: 21.12.0.97 class: PT2021_6
                                                        ProTools processID: 15697
                                                        Checking for running apps with bundle 'com.avid.ProTools'
                                                        NSArray.ArrayFromHandle count = 1
                                                        ProTools version: 21.12.0.97 class: PT2021_6
                                                        ProTools processID: 15697
                                                        
                                                        03.03.2022 18:59:55.45 <info> [Backend]: Mouse current pos is: (1939.805908203125, 305.3089904785156)
                                                        Clicking with mouse here: (72, 32)
                                                        
                                                        03.03.2022 18:59:55.45 <info> [Backend]: Moving mouse back to: (1939.805908203125, 305.3089904785156)
                                                        
                                                        03.03.2022 18:59:55.46 <info> [Backend]: Position is now: (1939.805908203125, 305.3089904785156)
                                                        
                                                        03.03.2022 18:59:55.75 <info> [Backend]: Mouse current pos is: (1939.805908203125, 305.3089904785156)
                                                        Clicking with mouse here: (1824, 93)
                                                        
                                                        03.03.2022 18:59:55.75 <info> [Backend]: Moving mouse back to: (1939.805908203125, 305.3089904785156)
                                                        
                                                        03.03.2022 18:59:55.76 <info> [Backend]: Position is now: (1939.805908203125, 305.3089904785156)
                                                        
                                                        03.03.2022 18:59:55.76 <info> [Backend]: << Command: Open Color Palette [user:default:ckzzq7qe9000e7910heo0ddcj]
                                                        
                                                        03.03.2022 18:59:58.39 <info> [Backend]: #StreamDeck: KeyDown (1,4) -> Back to PT Deck - Color Palette
                                                        
                                                        03.03.2022 18:59:58.39 <info> [Backend]: >> Command: Back to PT Deck - Color Palette [user:default:ckzzxghim000j7910oundw46v]
                                                        
                                                        03.03.2022 18:59:58.41 <info> [Backend]: << Command: Back to PT Deck - Color Palette [user:default:ckzzxghim000j7910oundw46v]
                                                        
                                                        03.03.2022 18:59:58.50 <info> [Backend]: Showing Deck "My Pro Tools Deck" on Device "Micah Loken's Deck" (We were called with device "Micah Loken's Deck")
                                                        [AxDeckInstance] InstanceShow: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        
                                                        03.03.2022 18:59:58.50 <info> [Backend]: [AxDeckInstance] TriggerDraw: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        [AxStreamDeckDevice] Device 'CL37K1A00965' -> ShowDeckInstance: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db
                                                        [AxStreamDeckDevice] DrawInstance. instance 'user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db'
                                                        
                                                        03.03.2022 18:59:58.50 <info> [Backend]: Showing Deck "My Pro Tools Deck" on Device "Micah Loken's Deck" (We were called with device "Micah Loken's Deck")
                                                        [AxDeckInstance] InstanceShow: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        
                                                        03.03.2022 18:59:58.50 <info> [Backend]: [AxDeckInstance] TriggerDraw: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        [AxStreamDeckDevice] Device 'CL37K1A00965' -> ShowDeckInstance: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db
                                                        
                                                        03.03.2022 18:59:58.51 <info> [Backend]: Showing Deck "My Pro Tools Deck" on Device "Micah Loken's Deck" (We were called with device "Micah Loken's Deck")
                                                        [AxDeckInstance] InstanceShow: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        [AxDeckInstance] TriggerDraw: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        [AxStreamDeckDevice] Device 'CL37K1A00965' -> ShowDeckInstance: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db
                                                        
                                                        03.03.2022 18:59:58.51 <info> [Backend]: Showing Deck "My Pro Tools Deck" on Device "Micah Loken's Deck" (We were called with device "Micah Loken's Deck")
                                                        [AxDeckInstance] InstanceShow: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        
                                                        03.03.2022 18:59:58.51 <info> [Backend]: [AxDeckInstance] TriggerDraw: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        [AxStreamDeckDevice] Device 'CL37K1A00965' -> ShowDeckInstance: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db
                                                        
                                                        03.03.2022 18:59:58.54 <info> [Backend]: Showing Deck "My Pro Tools Deck" on Device "Micah Loken's Deck" (We were called with device "Micah Loken's Deck")
                                                        [AxDeckInstance] InstanceShow: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        [AxDeckInstance] TriggerDraw: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        [AxStreamDeckDevice] Device 'CL37K1A00965' -> ShowDeckInstance: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db
                                                        
                                                        03.03.2022 18:59:58.54 <info> [Backend]: Showing Deck "My Pro Tools Deck" on Device "Micah Loken's Deck" (We were called with device "Micah Loken's Deck")
                                                        [AxDeckInstance] InstanceShow: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        
                                                        03.03.2022 18:59:58.54 <info> [Backend]: [AxDeckInstance] TriggerDraw: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db (My Pro Tools Deck) Device: 'CL37K1A00965'
                                                        [AxStreamDeckDevice] Device 'CL37K1A00965' -> ShowDeckInstance: user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db
                                                        
                                                        03.03.2022 18:59:58.62 <info> [Backend]: [AxStreamDeckDevice] DrawInstance. instance 'user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db'
                                                        
                                                        03.03.2022 18:59:58.74 <info> [Backend]: [AxStreamDeckDevice] DrawInstance. instance 'user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db'
                                                        
                                                        03.03.2022 18:59:58.86 <info> [Backend]: [AxStreamDeckDevice] DrawInstance. instance 'user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db'
                                                        
                                                        03.03.2022 18:59:58.98 <info> [Backend]: [AxStreamDeckDevice] DrawInstance. instance 'user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db'
                                                        
                                                        03.03.2022 18:59:59.10 <info> [Backend]: [AxStreamDeckDevice] DrawInstance. instance 'user:default:cku6k9r2l0000lu10a8we29rx:streamDeckHid.CL37K1A00965.eb4361ed-e6b0-4939-9856-628b288996db'
                                                        
                                                        03.03.2022 19:00:12.01 <info> [Backend]: [SF_FIREBASE_WS]: Sending keep-alive
                                                        
                                                        

                                                        If you notice, there are now five instances of the runForever script active... do that multiple times over a few hours and it will be much longer (I switch back and forth between applications all of the time).

                                                        As I mentioned before, this is fairly all over my head for the most part, but I can see what the code is trying to achieve, I'm not, however, seeing it behave very nicely though haha.

                                                        I hope this info shows better what I am trying to convey and again, your help is so greatly appreciated. Thank you!

                                                        1. Kitch Membery @Kitch2022-03-04 03:23:50.783Z

                                                          Hi @Micah_Loken,

                                                          I'm sorry if I was not clear in my last message.

                                                          This is expected behaviour. SoundFlow logs each event that occurs (that is related to SoundFlow), so that if something goes wrong we can work out what is causing the issue via a bug report.

                                                          If this behavior still bothers you after knowing this, you could always start the run-forever script manually or set it to start on the launch of Pro Tools rather than when Pro Tools becomes active. In turn this will not log the trigger events for the runForever script.

                                                          The issue we were seeing where SoundFlow was logging the same event every 100ms "was" a problem however. (but we've since corrected that.)

                                                          Also note that the log files are automatically deleted from your computer after 7 days.

                                                          I hope that makes sense.

                                                          1. MMicah Loken @Micah_Loken
                                                              2022-03-04 18:05:56.056Z

                                                              @Kitch - I understand! Thanks for the clarification.

                                                              You Rock!

                                      2. In reply toMicah_Loken:
                                        Kitch Membery @Kitch2022-02-26 02:14:36.657Z

                                        Hi again @Micah_Loken,

                                        Regarding your question about Pro Tools activating after returning from iZotope RX.

                                        It's probably best to use Christian's "Dialog Editing iZotope" package's "iZotope RX - Render & Spot" script for sending files back to Pro Tools from RX.

                                        var shuttleBtn = sf.ui.izotope.mainWindow.children.whoseDescription.endsWith('Main Window').first.children.whoseDescription.is("Shuttle").first;
                                        shuttleBtn.elementClick({}, "Could not click Send Back button");
                                        
                                        sf.wait({ intervalMs: 500 });
                                        
                                        sf.ui.proTools.appActivateMainWindow({}, "Could not activate Pro Tools");
                                        
                                        var win = sf.ui.proTools.floatingWindows.filter(function(w){ var t = w.title.value; return t.indexOf("Audio Suite: RX") == 0 && t.indexOf("Connect") >= 0 })[0];
                                        if (!win || !win.exists) throw "Could not find iZotope RX Connect AudioSuite window";
                                        
                                        win.buttons.whoseTitle.is("Render").first.elementClick({}, "Could not click Render");
                                        
                                        /* Uncomment to close when done
                                        sf.wait({ intervalMs: 100 });
                                        sf.ui.proTools.waitForNoModals();
                                        win.windowClose();
                                        */
                                        

                                        The way you have described your Pro Tools / RX deck setup seems to be working on my system. As a trouble-shooting step, be sure to check that you have a "Device" assigned to your Pro Tools Deck in the deck designer along with an application trigger for when Pro Tools becomes active.

                                        Rock on!

                                        1. MMicah Loken @Micah_Loken
                                            2022-02-28 20:49:21.553Z

                                            Hi Kitch,

                                            Thanks for your replies! The issue I am having with...

                                            var shuttleBtn = sf.ui.izotope.mainWindow.children.whoseDescription.endsWith('Main Window').first.children.whoseDescription.is("Shuttle").first;
                                            shuttleBtn.elementClick({}, "Could not click Send Back button");
                                            
                                            sf.wait({ intervalMs: 500 });
                                            
                                            

                                            ...is that when I start the script this way, the 'send back' process works too quickly on larger files that take a while. There is a dialog box that shows up explaining that iZotope is 'saving' the file first prior to sending back to PT. This is why I decided to throw this wait for command in it

                                            sf.ui.izotope.floatingWindows.whoseTitle.startsWith("Pro Tools").first.elementWaitFor({
                                                waitType: "Disappear",
                                                timeout: 20000,
                                            });
                                            

                                            I'm curious... is there a different way to wait on iZotope RX Audio Editor prior to moving back to PT so that it doesn't hang or mess up the rest of the script?

                                            1. Kitch Membery @Kitch2022-02-28 21:08:51.391Z

                                              Hi @Micah_Loken

                                              Ahh, I see what you mean. I'll have to investigate this further this evening. I do remember encountering this issue when working on large Audiobook sessions.

                                              Hopefully, I can find a solid solution.
                                              Will keep you posted. :-)

                                              1. MMicah Loken @Micah_Loken
                                                  2022-03-01 01:11:32.633Z

                                                  Great. Thanks for looking into it!

                                                  1. Kitch Membery @Kitch2022-03-02 01:22:09.419Z

                                                    Hi @Micah_Loken,

                                                    Try this script;

                                                    function rxSendBackAndRender() {
                                                        const izotopeMainWindow = sf.ui.izotope.mainWindow.children.whoseDescription.endsWith('Main Window').first;
                                                        const shuttleBtn = izotopeMainWindow.children.whoseDescription.is("Shuttle").first;
                                                    
                                                        shuttleBtn.elementClick({}, "Could not click Send Back button");
                                                    
                                                        sf.wait({ intervalMs: 500 });
                                                    
                                                        sf.ui.proTools.appWaitForActive({}, `Pro Tools did not activate`);
                                                    
                                                        sf.ui.proTools.appActivateMainWindow({}, `Could not activate Pro Tools main window`);
                                                    
                                                        // Manual wait for iZotope Connect AudioSuite plugin to digest the audio sent back from RX.
                                                        sf.wait({ intervalMs: 1000 });
                                                    
                                                        const rxConnectWin = sf.ui.proTools.floatingWindows.find(w => {
                                                            let t = w.title.value;
                                                            return t.indexOf("Audio Suite: RX") == 0 && t.indexOf("Connect") >= 0
                                                        });
                                                    
                                                        if (!rxConnectWin || !rxConnectWin.exists) throw "Could not find iZotope RX Connect AudioSuite window";
                                                    
                                                        const renderBtn = rxConnectWin.getFirstWithTitle("Render");
                                                    
                                                        renderBtn.elementClick({}, "Could not click Render");
                                                    }
                                                    
                                                    rxSendBackAndRender();
                                                    

                                                    Unfortunately, there is no way to programmatically know when the iZotope RX Connect AudioSuite plugin has digested the audio sent back from RX. I've added a wait in the script above. You may be able to adjust it to a shorter length depending on your system.

                                                    let me know how it goes :-)

                                                    Rock on!

                                                    1. MMicah Loken @Micah_Loken
                                                        2022-03-02 01:34:23.308Z

                                                        Thanks for this Kitch! much appreciated. I'll give it a go when I have a bit.

                                                        In the meantime... isn't this a way to wait for the window that pops up?

                                                        sf.ui.izotope.floatingWindows.whoseTitle.startsWith("Pro Tools").first.elementWaitFor({
                                                            waitType: "Disappear",
                                                            timeout: 20000,
                                                        });
                                                        

                                                        The pop up is always called "Pro Tools" Then " 1" or " 2" etc when sending files back to PT from the standalone RX app. The reason for the timing out of 20 seconds is in case it hangs too long. I guess if a file takes more than 20 seconds to export then it would be too large at that point any way I would assume which is why I went with 20000ms

                                                        That portion seems to work for me and iZotope does not hang with that in the code. Could you try that on your end and see if you have a good result?

                                                        Thanks!

                                                        1. Kitch Membery @Kitch2022-03-02 02:44:52.211Z

                                                          Hi @Micah_Loken,

                                                          The "wait" I was describing is not for the amount of time it takes to send the audio back to Pro Tools (that is already dealt with in the script). The wait time is for the iZotope RX Connect Audio suite plugin to register that it has received new audio and that audio is ready to render.

                                                          Out of interest, how long an audio file are you talking about exporting from RX to Pro Tools? (the bit depth and sample rate of the file may also be helpful).

                                                          1. MMicah Loken @Micah_Loken
                                                              2022-03-02 04:48:30.838Z

                                                              Ah gotcha. I understand what you are meaning

                                                              Sometimes 20-30min files if needed at 48kHz/24-bit which takes a bit for the standalone app to process/save/export (5-10 seconds), which is the reason for the script needing to wait for a bit sometimes prior to moving on with the process. This is a less common practice for me all things considered, but something I was trying to remedy so that I could use my script for both short and long files when sending back to PT.

                                                              On first attempts, your script is working REALLY well for sending back to PT/Rendering. Thanks a bunch!

                                                              Back to the color palette questions from earlier (haha), I'm not seeing where to get my deviceID from. The only option I can see for the stream deck is getDeviceBySerialNumber. Where would I locate the device ID like yours?

                                                              const deviceId = "mobile.CDB651B5-0ADE-4456-A8E5-286C1F1E66C0--Kitch_s-iPhone";
                                                              

                                                              Thanks!

                                                              1. In reply toKitch:
                                                                MMicah Loken @Micah_Loken
                                                                  2022-03-02 18:45:58.271Z

                                                                  I answered my own question regarding the deviceID... found it in the logs. Thanks again for your help. I'm sure I'll have some more questions for you. Much appreciated!

                                                                  1. Kitch Membery @Kitch2022-03-02 18:49:24.707Z

                                                                    Nice work @Micah_Loken!
                                                                    Rock on!