No internet connection
  1. Home
  2. Support

Scripts Fail (Menu Click) if track is at bottom physical display.

By Alberto Cruz @Alberto_Cruz
    2023-01-15 08:09:55.434Z

    Hi!

    No specific script in mind, it does this on a couple of different scripts for me. (wasn't sure if this should be marked as a Question, Issue, or Discussion, maybe there is a Mod somewhere that can assign it properly if I'm off?)

    Just noticed a common point of failure that always seems to happen to me after something kinda like this:

    //Selected Track in this situation is below the visible area of the edit window
    sf.ui.proTools.invalidate().selectedTrack.trackScrollToView();
    
     sf.ui.proTools.invalidate().selectedTrack.titleButton.popupMenuSelect({
            isRightClick: true,
            menuPath: [/*ANYTHING*/]
        });
    

    Log:
    Could not open popup menu (>>>SCRIPT NAME<<<)
    Popup menu was not found
    Popup window was not found after waiting 2000 ms

    Even though the Menu does actually pop up, but just nothing happens after it pops up.
    Strangely enough, if I resize the protools window, so its around 1/4th of the screen above the bottom of the screen, this goes away.
    Some other details in case its relevant:
    Monitor Resolution: 3440x1440
    Automatically Hide and Show the Dock is enabled

    Any Ideas as to why this is happening? Maybe there is a clever way to make trackScrollToView() put the track at the top of the window instead bypassing this issue alltogether?

    Solved in post #4, click to view
    • 9 replies
    1. S
      SoundFlow Bot @soundflowbot
        2023-01-15 08:09:56.675Z

        Thanks for contacting SoundFlow support.

        Please note, that the best way to get help with a script, macro or other content installed from the Store or content that you've made yourself, is to select the script/macro, then click the red Need help button, and then click "Get help with this script or macro".
        By using this method, we will get access to more information and so should be able to help you quicker.
        You can read more about how this works here: bit.ly/sfscripthelp

        If you're seeing an error that isn't related to scripts or macros, and you think this is a bug in SoundFlow, please file a Help/Issue bug report.
        You can see how to do this by going to bit.ly/sfhelpissue

        1. S
          In reply toAlberto_Cruz:
          SoundFlow Bot @soundflowbot
            2023-01-16 11:23:10.335Z

            This report was now added to the internal issue tracked by SoundFlow as SF-677

            1. In reply toAlberto_Cruz:

              Hi Alberto,

              Thanks for your report. We're already tracking this bug internally. I've added your report to the issue so we can update this thread when we've solved it.

              Reply1 LikeSolution
              1. Pinewood Studios @Pinewood_Studios
                  2024-12-21 12:22:38.018Z

                  Hi Christian,

                  I just wanted to see if there are any updates on this issue now? I have experienced the same ("Could not open preset selector, Could not open popup menu, Popup menu was not found") when setting the automation mode for the bottommost track in my session.

                  For the time-being, I've made a very ugly workaround involving toggling and un-toggling the Zoom Toggle button.

                  --Fergus

                  1. cc @Chad, can you look into this?

                    1. Chad Wahlbrink @Chad2024-12-21 18:17:57.016Z

                      @Pinewood_Studios & @chrscheuer,

                      I can replicate that error when the selected track's automation button is fully off screen, like this:

                      and I run this code:

                      // If we are in "latch" set mode to "read," otherwise, set to "latch"
                      let mode = sf.ui.proTools.selectedTrack.automationModeButton.invalidate().value.value == 'latch' ? 'read' : 'latch'; 
                      
                      sf.ui.proTools.selectedTrack.automationModeButton.popupMenuSelect({
                              menuPath:[mode]
                      })
                      

                      The error thrown is:

                      21.12.2024 13:15:02.92 <info> [Backend]: Logging error in action (01) WaitForPopupMenuAction: Popup window was not found after waiting 2000 ms
                      Logging error in action (01) OpenPopupMenuFromElementAction: Popup menu was not found
                      Logging error in action (01) PopupMenuSelectAction: Could not open popup menu
                      
                      21.12.2024 13:15:02.92 <info> [Backend]: !! Command Error: 9270 - Popupmenu Not Found [user:clf15xh4q00001b1018rtgniw:cm4yhi379000jhv10e6xw3rx9]:
                      Could not open popup menu (9270 - Popupmenu Not Found: Line 17)
                          Popup menu was not found
                          Popup window was not found after waiting 2000 ms
                      

                      However, if I use sf.ui.proTools.invalidate().selectedTrack.trackScrollToView();, then it works as expected

                      sf.ui.proTools.invalidate().selectedTrack.trackScrollToView();
                      
                      // If we are in "latch" set mode to "read," otherwise, set to "latch"
                      let mode = sf.ui.proTools.selectedTrack.automationModeButton.invalidate().value.value == 'latch' ? 'read' : 'latch'; 
                      
                      sf.ui.proTools.selectedTrack.automationModeButton.popupMenuSelect({
                              menuPath:[mode]
                      })
                      
                      1. Pinewood Studios @Pinewood_Studios
                          2024-12-22 10:32:55.320Z

                          Hey Chad,

                          Thanks for having a look. That's not quite what I'm experiencing - the automation button is fully on-screen for this track. The scroll into view fix isn't working for me, probably since I have all of the tracks fit to the window (ctl+alt+up arrow), so the session literally can't scroll the bottom track into view. The script below only experiences the bug if the only track to put into the desired automation mode is the one at the very bottom.

                          Here is the WIP script. Just FYI, I haven't yet gone through the process of making it robust (it'll fail if the automation mode button is hidden or if the 'Object' track display is hidden (tracks are in 'mini' view)). Pretty sure I know how to do all that though so I'll fix at a later date.

                          // PRO TOOLS START SCRIPT
                          if (!sf.ui.proTools.isRunning) throw 'Pro Tools is not running';
                          sf.ui.proTools.appActivateMainWindow();
                          sf.ui.proTools.mainWindow.invalidate();
                          
                          // Select first track (needs to happen first or the automationModeSet command throws an error if nothing is selected)
                              let ptTracks = sf.app.proTools.tracks.invalidate().allItems.map(track => track.name);
                              sf.app.proTools.selectTracksByName({trackNames: [ptTracks[0]], selectionMode: "Replace" });
                          
                          //Set all to off
                              sf.ui.proTools.selectedTrack.invalidate().automationModeSet({trackTargetMode: "AllTracks", automationModeName: "off"});
                          
                          //Go through each track
                              var objectToggleButton;
                              let objectTracks = [];
                              ptTracks.forEach(function(currentTrack){
                          
                                  //Select track then scroll into view (otherwise the UI elements can't be controlled)
                                  sf.app.proTools.selectTracksByName({trackNames: [currentTrack], selectionMode: "Replace" });
                                  sf.ui.proTools.invalidate().selectedTrack.trackScrollToView();
                          
                                  objectToggleButton = sf.ui.proTools.selectedTrack.groups.whoseTitle.is("Object").first.buttons.whoseTitle.is("Bus/Object Toggle").first
                          
                                  //If the automation toggle button exists
                                  if(objectToggleButton.exists){
                                      
                                      //If Object Mode is selected then add it to the array of tracks to put into 'read'
                                      if(objectToggleButton.value.value == "object selected"){
                                          objectTracks = objectTracks.concat([currentTrack]);
                                      };
                                  };
                              });
                          
                          //Select all object tracks and put them into read
                          sf.app.proTools.selectTracksByName({trackNames: objectTracks, selectionMode: "Replace" });
                          sf.ui.proTools.selectedTrack.invalidate().automationModeSet({trackTargetMode: "SelectedTracks", automationModeName: "read"});
                          
                          //Wait for it to be set to read
                              while(sf.ui.proTools.selectedTrack.automationModeButton.invalidate().value.value !== "read"){
                                  sf.wait({
                                      intervalMs: 50
                                  });
                              };
                          

                          The error is thrown for line 36.

                          Cheers.

                          1. Chad Wahlbrink @Chad2024-12-22 14:01:17.674Z

                            Hi @Pinewood_Studios,

                            I'm struggling to get an error with the script you shared. I don't work with Atmos sessions much, so I may misunderstand your setup regarding the object tracks.

                            I suggest creating a new post using the “Script or Macro Help” Workflow for this question.

                            If possible, after you create a new thread, it would be beneficial to share a screen recording of the issue as well.

                            1. Pinewood Studios @Pinewood_Studios
                                2024-12-22 15:00:33.834Z

                                Hi Chad. Sounds good - I will do this when I get a chance soon.