No internet connection
  1. Home
  2. How to

Type Text Missing Letters

By Gabriel Lundh @Gabriel_Lundh
    2021-02-12 17:24:00.782Z

    Hi there!

    I am so close to optimizing a script which includes the Dolby Atmos Renderer, which in turn complicates stuff.
    The last part of the script (that is problematic) is opening a master file in the renderer from the correct file path. I have tried dosens of ways to help it find the path I want it to find and now I managed to get the path by stealing the correct path text from Pro Tools Bounce Window (through the UI Element trick, by @Kitch) and that works. I am using a var to hold the path as sessionDir. The problem is that when SF pastes the path through:

    sf.keyboard.type({ text: sessionDir });
    

    It sometimes misses a the u in /users which makes the path invalid and not working for the renderer.
    If I restart SF and Pro Tools, the script runs fine.
    Is there a chache problem with this or do any of you have a better suggestion?

    Thanks a lot!
    All the best,
    Gabriel

    Solved in post #5, click to view
    • 6 replies
    1. Hi Gabriel,

      This likely happens because SF types the text too fast. When you type the initial "/", then, if I'm guessing correctly, the Open dialog needs to open the sheet for you to enter the actual path.

      Please use a function like navigateToInDialog from here:

      This is in turn taken from some of my scripts in the Pro Tools Utilities package (they're all open source).

      1. GGabriel Lundh @Gabriel_Lundh
          2021-02-14 16:15:09.035Z

          Hi Christian!
          Thanks for your reply! I am using this great code in the beginning of the script, when I'm in Pro Tools and it works like a charm. However, in the renderer - SF cannot find the sheet UI element and therefore throws of the script, hence I had to find a workaround. I also tried the copy paste command, and that would have worked, but for some unfortunate reason, the renderer path sheet wont take in any pasting (not even with cmd + v...) I will try and see if I can insert some manual waiting times to give SF time to write the path.

          Thank you for trouble shooting!
          All the best,
          Gabriel

          1. That sounds like a good plan :)

            1. GGabriel Lundh @Gabriel_Lundh
                2021-02-15 09:23:41.108Z

                Hi again Christian!
                I solved the problem by just looking closer to the script and seeing how SF found other UI elements from the renderer. It worked out by just adjusting the script you were refering to into:

                //Open the Go to... sheet
                sf.keyboard.type({ text: '/' });
                
                //Wait for the sheet to appear
                sf.ui.app('com.dolby.atmos.renderer').mainWindow.sheets.whoseDescription.is('choose a file').first.sheets.first.elementWaitFor({ timeout: 1000 }, 'Could not find "Go to" sheet in the Save/Open dialog').element;
                
                //Paste the Bounce dir
                sf.keyboard.type({ text: sessionDir.slice(1) });
                
                sf.ui.app('com.dolby.atmos.renderer').mainWindow.sheets.whoseDescription.is('choose a file').first.sheets.first.buttons.whoseTitle.is('Go').first.elementClick();
                

                I also managed to figure out how to remove the first / of the session path stolen from the Bounce Mix window in PT as the first / prompting the sheet stays there, thanks to you and Samuel explaining the .slice functions.

                Just wanted to let you know that I really appreciate the help here on the forum and hopefully will stop asking such noob questions soon enough!
                All the best,
                Gabriel

                Reply2 LikesSolution
                1. Everyone here were (and still are) noobs. No worries!

                  1. samuel henriques @samuel_henriques
                      2021-02-15 19:47:09.737Z

                      Yep, I'm a noob too. 😁
                      Just happy to help.