No internet connection
  1. Home
  2. How to

Refreshing Pro Tools UI when new tracks are created

By Thomas Gloor @Thomas_Gloor
    2024-08-01 09:56:21.001Z

    Hi everyone,

    Since I updated to 2024.6, some of my scripts struggle, especially when new tracks are created or tracks are deleted.

    I tried a lot of refresh methods, such as sf.keyboard.press and invalidate() but it doesn't seem to resolve my issues.

    Does anybody have a bit of guidance they can spare?

    Thank you!

    • 7 replies
    1. Kitch Membery @Kitch2024-08-01 18:32:43.772Z2024-08-02 13:27:23.875Z

      Hi @Thomas_Gloor,

      Thanks for asking.

      Pro Tools Tracks are Cached in the sf.ui.proTools.mainWindow. So any time you are working with Pro Tools tracks, it's best to place the codesf.ui.proTools.mainWindow.invalidate() at the top of the script, and then add the sf.ui.proTools.mainWindow.invalidate() code at any point that you need the track information to be refreshed.

      If you've tried this, and you are still experiencing issues, please let me know.

      1. In reply toThomas_Gloor:
        Kitch Membery @Kitch2024-08-01 18:35:00.223Z

        If however, you are experiencing an issue with Pro Tools menu items not refreshing you can refresh them by adding sf.keyboard.press({keys:"left"}); before any Menu Click action where the menu item needs to be refreshed.

        I hope that helps. :-)

        1. TThomas Gloor @Thomas_Gloor
            2024-08-02 07:23:48.610Z

            Thank you @Kitch !

            For the "left" refresh. Do I do it before opening the menu?

            I'll try again to invalidate the main window but it doesn't seem to work.

            1. In reply toKitch:
              TThomas Gloor @Thomas_Gloor
                2024-08-03 07:42:36.474Z

                Hi again @Kitch

                Could you tell me what else is cached in the mainWindow?

                Also, when you say menu item refresh, would that apply to selecting a track to do a Track -> Make active menu click for example?

                1. Chris Shaw @Chris_Shaw2024-08-03 17:27:52.989Z2024-08-03 17:53:49.966Z

                  Occasionally during the execution of a script the PT tools main menu items (File, Edit, View, Track, Clip, etc) become unresponsive which will throw an error. sf.keyboard.press({keys:"left"}); will refresh the main menu and make it responsive again.

                  From what I understand, the mainWindow cache contains all of the elements in the main window but most importantly it is where all of the track headers are cached (this includes track names, track visibility, track order, etc). The track header contains all of the UI elements in a track (mutes, solo buttons, inserts, track color, output assignments) - pretty much everything in the main window including counters etc.

                  Because of this whenever tracks are changed (specifically if anything changes or has changed in the track list window) then you need to invalidate the main window using sf.ui.proTools.mainWindow.invalidate() before proceeding in a script. However, if an element besides a track is changed in the main window (the value of an send assignment for example), you should only invalidate the element rather than the whole window. Invalidating the entire main window (or sf.ui.proTools) incurs a performance hit in SF.
                  If you haven't read it already there's a much more in-depth explanation from Christian here: When to use invalidate() #post-2

                  1. TThomas Gloor @Thomas_Gloor
                      2024-08-07 19:02:51.665Z

                      Hey @Chris_Shaw ,

                      Thank you for your answer! I usually apply pretty much what you describe, and never encountered a lot of problems. But I'll dig deeper!

                      1. Kitch Membery @Kitch2024-08-07 21:00:31.785Z

                        Hi @Thomas_Gloor,

                        For any scripts that you encounter an issue like this, it may be worthwhile using the red "Need Help" button in SoundFlow that way we'll have the script and any other information we need to investigate the issue further. For any new threads with this particular issue, please feel free to tag me so that I can take a look.

                        Rock on!