No internet connection
  1. Home
  2. Support

useSfx fails to recognize when Import Session Data window is opened

By Matt Friedman @Matt_Friedman
    2025-10-23 18:15:51.886Z

    Title

    useSfx fails to recognize when Import Session Data window is opened

    Content type

    script

    Content name

    test sfx

    Content package

    SF Help

    Version info

    OS: macOS 15.5.0
    SoundFlow: 6.0.1
    Pro Tools: 25.10.0.144

    What do you expect to happen when you run the script?

    Open Session Import Data Window

    Are you seeing an error?

    Element was not found or removed after waiting 2000 ms (test sfx: Line 5)

    What happens when you run the script?

    It opens the Session Import Window just fine, but fails to recognize it has been opened.

    How were you running this script?

    Other

    How important is this issue to you?

    3

    Details

    {
        "textExpected": "Open Session Import Data Window",
        "textError": "Element was not found or removed after waiting 2000 ms (test sfx: Line 5)",
        "textWhatHappens": "It opens the Session Import Window just fine, but fails to recognize it has been opened.",
        "inputHowRun": "Other",
        "inputImportance": 3,
        "textTitle": "useSfx fails to recognize when Import Session Data window is opened"
    }

    Source

    sf.ui.useSfx();
    
    sf.ui.proTools.menuClick({ menuPath: ["File", "Import", "Session Data..."] });
    
    sf.ui.proTools.windows.invalidate().whoseTitle.is("Open").first.elementWaitFor();
    
    

    Links

    User UID: 2FEbvmxaByaWbeBh5fRIjEwuOjA3

    Feedback Key: sffeedback:2FEbvmxaByaWbeBh5fRIjEwuOjA3:-OcHHBg2eG7viK6AbSYf

    Feedback ZIP: qI7OQla1fAnLeok02n5wRaR0mlbYh2FXc3CRowtheTGTsJNSfoI4bSTI9RH5t46ygEZuMYm53vK4UXbjnoFwCXka5KqPi38S+Cb/c/4TVYWx9KSLZU8zDQg+1+XsY8caBbOQhCHs2lSYZ745XgeuHggGpQjVUmzfmCjW41xRVY6O/WLBWjCUhwEqWWOoVh3ZBS6o2o/htJKNKyXlixiZzU6ojTQr3n8U+jgGxbBzCpBmrv3adkCzZw/AsHcjPJIajPXaJ4e3Uc7+kcmJMP7aJmZAGlyLFQx4Xmvbx+RBt2svB6Dg4yCFOsE2rRhv6SStRGUB1+xQMtWt7TlNyPsL+g==

    • 21 replies

    There are 21 replies. Estimated reading time: 11 minutes

    1. Matt Friedman @Matt_Friedman
        2025-10-23 18:19:12.864Z

        Just tested with Open -> Session... as well and same result. Script fails to wait for window to appear, even though it has appeared.

        1. In reply toMatt_Friedman:
          Kitch Membery @Kitch2025-10-24 18:24:52.287Z

          Hi @Matt_Friedman

          Thanks for logging this.

          This will be addressed in the information we will soon provide regarding converting/adapting existing scripts to SFX.

          SFX will allow you to bypass open windows, so your code can be converted by this...

          sf.ui.useSfx();
          
          sf.ui.proTools.menuClick({
              menuPath: ["File", "Import", "Session Data..."],
              filePaths: [`/Users/kitchmembery/Desktop/Session_Folder/Session_File.ptx`]
          });
          

          And a fallback solution could be implemented like this...

          sf.ui.useSfx();
          
          if (sf.ui.proTools.isSfxApplication) {
              // SFX code to bypass the "Open" dialog
              sf.ui.proTools.menuClick({
                  menuPath: ["File", "Import", "Session Data..."],
                  filePaths: [`/Users/kitchmembery/Desktop/Session_Folder/Session_File.ptx`]
              });
          } else {
              // Non SFX code to open a file in the Session Data's open window
              sf.ui.proTools.menuClick({ menuPath: ["File", "Import", "Session Data..."] });
              sf.ui.proTools.windows.invalidate().whoseTitle.is("Open").first.elementWaitFor();
          
              // Rest of the code to select a file in the "Open" dialog the old way...
          }
          

          No doubt you were just logging this issue because the code was not working, but I thought I'd provide a little extra information to help you get your scripts working in the meantime.

          I hope that helps. :-)

          1. Matt Friedman @Matt_Friedman
              2025-10-24 19:10:17.075Z

              Wait, what?!?!

              You mean... no more navigateToInDialog??? The bane of my existence???

              This changes everything!!!!! 🔥🔥🔥❤️❤️❤️👍👍👍

              1. Kitch Membery @Kitch2025-10-24 19:11:09.029Z

                Yes my friend!!! SFX is the future. :-)

                1. Does this apply to EXPORT too?! I can already Import via SDK...

                  This is amazing, can't wait for the documentation.

                  1. Kitch Membery @Kitch2025-10-24 21:22:07.665Z

                    It should do... Give it a try :-)

                  2. In reply toKitch:
                    Matt Friedman @Matt_Friedman
                      2025-10-24 21:31:08.354Z

                      Of course the script I decide to test this on, it works great except that scripts failing later on due to some other issue. I posted a new topic regarding that issue since I’m too excited to wait for documentation.😂

                      1. Kitch Membery @Kitch2025-10-24 21:32:18.270Z

                        I'll see if I have time to get around to it soon.

                  3. In reply toKitch:
                    Matt Friedman @Matt_Friedman
                      2025-10-25 14:52:22.681Z

                      Hi @Kitch I noticed something and thought I'd post it here before maybe starting a whole other topic.

                      When using SFX, in this scenario, after the script finishes if you happen to hit the key-command for Importing Session Data manually (opt-shift-i), instead of getting the normal finder dialog to search for a file to import, you are instead shown Pro Tools's import dialog, that is to say, it's re-loading the same file the script just loaded automatically, and you have to wait a couple seconds until the manual behavior return to normal in Pro Tools.

                      If that didnt make sense, lol, here's a video:
                      First, the normal behavior without SFX, then the unusual behavior with SFX enabled
                      https://www.dropbox.com/scl/fi/1fv71r9gr5kufoiuytjnc/Screen-Recording-2025-10-25-at-7.50.45-AM.mov?rlkey=qo6zedcdx2gqucy8ozu5fkshu&dl=0

                      1. In reply toKitch:
                        Matt Friedman @Matt_Friedman
                          2025-11-02 18:08:45.003Z

                          Hi @Kitch

                          One thing I can't figure out with the new SFX filePaths property in a menuClick method is whether or not it's possible to deal with the situation when there's a Pro Tools dialog first...

                          For example:
                          Export Selected Tracks as New Session...
                          Save Session as Copy In...

                          Each of those require you to deal with a Pro Tools dialog before you get to the actual Save Dialog, so of course when I tried using filePaths with those, it did not work and required going back to the old NavigateToInDialog way.

                          Is there a way of handling these with SFX?

                          1. Hey Martin, I toyed around with it I just haven’t built an actual script with it. But basically as near as I can tell - think of the file path in export session date menu click as a call back. Automate the export window as you normally would with SFX UI and when you press ‘done/save/whatever the button that confirms your settings is named these days’ wit a SFX element click it will simply skip the file save window and execute.

                            Like I said I only roughed it in quickly, have not sat down and committed to a full build but that seems to be the way.

                            Happy coding!
                            Owen

                            1. Matt Friedman @Matt_Friedman
                                2025-11-03 17:34:40.922Z

                                That doesn't work, actually. Once you disperse with the intermediate window (either manually or via SF) you get one of these wonderful errors.

                                1. Yes, so, kind of funky but in your file path on the menu click define the name of the session too, just as if you were saving the file. 😅 sorry I didn’t mention that I futzed when I did it and did get it to generate a session that way.

                                  1. Matt Friedman @Matt_Friedman
                                      2025-11-03 18:13:22.329Z2025-11-03 18:28:47.029Z

                                      Still no success. With this code, it gets through w/o errors. But nothing is actually saved to the destination.

                                      sf.ui.useSfx();
                                      
                                      function exportSelectedTracks(path, name) {
                                          if (!sf.ui.proTools.selectedTrackCount) {
                                              return
                                          }
                                      
                                          const savePath = `${path}/${name}`;
                                          const saveName = `${savePath}/${name}.ptx`
                                          
                                          sf.ui.proTools.menuClick({
                                              menuPath: ['File', 'Export', 'Selected Tracks as New Session...'],
                                              filePaths: [savePath, saveName],
                                          });
                                      
                                          const win = sf.ui.proTools.windows.whoseTitle.is("Save Copy In...").first;
                                          win.elementWaitFor();
                                          win.checkBoxes.whoseTitle.is("Audio Files").first.elementClick();
                                          win.buttons.whoseTitle.is("OK").first.elementClick();
                                          win.elementWaitFor({ waitType: "Disappear" });
                                      }
                                      
                                      exportSelectedTracks('~/Desktop', 'Test');
                                      
                                      1. Matt Friedman @Matt_Friedman
                                          2025-11-03 18:31:59.939Z

                                          I figured it out. It seems that we can't use the "Tilde" in this situation. You need to explicity define the path like /User/matt/Desktop and not do something like ~/Desktop

                                          1. Kitch Membery @Kitch2025-11-03 18:34:44.582Z

                                            Hi @Matt_Friedman

                                            Yes, that may be the case... Can I get you to log a Help/Issue report for this when you have a chance? :-)

                                            Thanks in advance.

                                            1. Matt Friedman @Matt_Friedman
                                                2025-11-03 20:46:21.753Z
                                              • In reply toMatt_Friedman:

                                                Thanks for doing the research, clipping and copying, lol. Luckily for me, most of the scripts I use this with do not involve a ~, great work on this function man!

                                                1. In reply toMatt_Friedman:
                                                  Kitch Membery @Kitch2025-11-03 19:27:05.085Z

                                                  Hi @Matt_Friedman

                                                  Out of interest, does it by chance work without the tilda?

                                                  1. Matt Friedman @Matt_Friedman
                                                      2025-11-03 20:42:42.809Z

                                                      It works if you specify the explicit path, but that's not useful when you don't know the system the script will run on, hence the Tilde

                                                      To get around that I'm programmatically replacing the tilde if it exists, with sf.appleScript.finder.home.path.toString()

                                                      1. Kitch Membery @Kitch2025-11-03 21:02:45.007Z

                                                        Thanks @Matt_Friedman.

                                                        Glad you found that workaround. :-)