No internet connection
  1. Home
  2. Support

How to resolve Could not pick UI element error

By William Harp @William_Harp
    2022-09-09 19:46:44.790Z

    Hello,

    Im trying to access "Link/Unlink Object and Audio Recording" in sound flow but I get this error and using the UI Picker:
    Could not pick UI element: System.NullReferenceException: Object reference not set to an instance of an object.
    at SoundFlow.Shortcuts.Ax.AxNodes.AxProTools.d__124.MoveNext() + 0x146
    at System.Collections.Generic.LargeArrayBuilder1.AddRange(IEnumerable1) + 0x4c
    at System.Collections.Generic.EnumerableHelpers.ToArrayT + 0xb0
    at SoundFlow.Shortcuts.Ax.AxNodes.AxPathFinder.Find(PointF) + 0x23e
    at SoundFlow.Shortcuts.Interfaces.Recording.CapturingController.<>c__DisplayClass16_0.b__0() + 0x5e
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x1c
    at sfbackend!+0x14f0935
    at sfbackend!+0x14f0866
    at SoundFlow.Shortcuts.ServerController.d__58.MoveNext() + 0x18b
    --- End of stack trace from previous location where exception was thrown ---
    at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() + 0x1c
    at sfbackend!+0x14f0935
    at sfbackend!+0x14f0866
    at SoundFlow.Shortcuts.Server.BackendServer.d__17.MoveNext() + 0xcc

    Im trying to access it from either of these two menu's:

    Solved in post #7, click to view
    • 7 replies
    1. Hi William,

      Thanks for reporting this. Unfortunately, I don't have access to that tab for Dolby Atmos, so it might be difficult for us to troubleshoot here.

      Did you find a workaround since posting this?

      1. In reply toWilliam_Harp:
        Chris Shaw @Chris_Shaw2022-09-16 17:24:47.605Z2022-09-16 17:35:01.205Z

        I was able to use the Picker without any problems.
        These will click those buttons for you:

        //Unlink button in Peripherals page
        sf.ui.proTools.windows.whoseTitle.is("Peripherals").first.checkBoxes.whoseTitle.is("Link Object and Audio Recording").first.elementClick();
        
        // Object button in edit window (for a track called Audio 1)
        sf.ui.proTools.trackGetByName({ name: 'Audio 1' }).track.groups.whoseTitle.is("Object").first.buttons.whoseTitle.contains("Object Control Mode").first.elementClick();
        

        I've edit the button title in the second UI element because its name changes depending upon what state it's in. Using contains("Object Control Mode") will select that button regardless of its state

        1. WWilliam Harp @William_Harp
            2022-09-16 17:34:38.523Z

            Hey Chris,

            When adding .elementClick() to the end of the Peripheral line I get this error:
            ClickButtonAction requires UIElement

            Additionally, when calling elementClick() using the track version it just clicks the object record button and doesn't actually toggle the link state.

            Are you experiencing something different in this scenario? Im curious if its a Pro Tools version issue for me or something?

            Thanks

            1. I've reedited the the response I have above to be a bit more clear.
              Re: the first bit of code - the peripherals window and Dolby Atmos tab must be visible in order for elementClick() to work

              As for the second
              When I hover my mouse near the object control button I get this tooltip:

              I'm not sure how you're getting "Unlink Object and Audio Recording". I don't think you can toggle Unlink Object and Audio Recording from the Edit window. I assumed that since you had the green object button highlighted you were looking for a way to toggle it.

              Which versions of PT / OSX / SoundFlow are you running?

              1. WWilliam Harp @William_Harp
                  2022-09-16 17:50:55.784Z

                  When you right click the Object Control Mode Master button it comes up with the link/unlink window.

                  Thank you for the insight on the peripherals code. I'll keep that in mind.

                  I am running 2022.7, 12.3.1, and 5.1.5

                  Thank you for your help!

                  1. Chris Shaw @Chris_Shaw2022-09-16 18:47:09.132Z2022-09-16 18:54:23.939Z

                    This script should Link/Unlink Object and Audio Recording for you:

                    sf.ui.proTools.appActivate();
                    
                    // Open Peripherals window
                    sf.ui.proTools.menuClick({
                        menuPath: ["Setup", "Peripherals..."]
                    })
                    
                    // Define periphWindow
                    const periphWindow = sf.ui.proTools.windows.whoseTitle.is("Peripherals").first;
                    
                    // Wait for Periherals window to open
                    periphWindow.elementWaitFor()
                    
                    // Toggle Link Object and Audio Recording
                    periphWindow.checkBoxes.whoseTitle.is("Link Object and Audio Recording").first.elementClick();
                    
                    /// Get state of Link Object and Audio Recording checkbox
                    const isLinked = periphWindow.checkBoxes.whoseTitle.is("Link Object and Audio Recording").first.isCheckBoxChecked;
                    
                    // Convert checkbox state to Enabled / Disabled string
                    const linkState = (isLinked) ? "Enabled" : "Disabled"
                    
                    // Close Peripherals window
                    periphWindow.buttons.whoseTitle.is("OK").first.elementClick();
                    
                    // Notify user of link state
                    log(`Link Object and Audio Recording is ${linkState}`, "")
                    
                    Reply1 LikeSolution
                    1. WWilliam Harp @William_Harp
                        2022-09-16 18:55:54.666Z

                        Exceptional! Thank you Chris