No internet connection
  1. Home
  2. How to

Import Audio Macro

By Martin Pavey @Martin_Pavey
    2020-10-11 16:58:53.438Z

    Hi there,
    I hope everyone at Soundflow is doing well.
    I've recently swapped to a new Mac and have to run Catalina and some of my shortcuts have broken as a result.
    I used to have an Import Audio Macro based on key stroke shortcuts, but this no longer works because return doesn't press the 'Done' button in the Import Audio window. The following windows work fine.
    Is there a way to press that pesky button?
    Thanks.

    • 16 replies

    There are 16 replies. Estimated reading time: 10 minutes

    1. Hello Martin!

      Add this line to your script replacing the keystrokes:
      sf.ui.proTools.windows.whoseTitle.is('Open').first.buttons.whoseTitle.is('Done').first.elementClick({});

      As a rule of thumb it is best to use SoundFlow's Click UI Element action to find a button to click as opposed to simulating keystrokes to avoid errors like these!

      1. MMartin Pavey @Martin_Pavey
          2020-10-12 13:34:14.276Z

          Thanks Raphael,
          That bit works great.
          Here is what I have now but the last part doesn't work.
          It waits for the 'Audio Import Options' window to appear but SF doesn't see the window when it does pop up.

          sf.keyboard.press({
              keys: "cmd+c",
          });
          
          sf.ui.proTools.windows.whoseTitle.is('Open').first.buttons.whoseTitle.is('Done').first.elementClick({});
          
          sf.ui.proTools.windows.whoseTitle.is('Open').first.children.whoseRole.is("AXStaticText").whoseValue.is('Choose a destination folder').first.elementWaitFor();
          
          sf.keyboard.press({
              keys: "return",
          });
          
          sf.ui.proTools.windows.whoseTitle.is('Audio Import Options').first.getElement('AXTitleUIElement').elementWaitFor({
              timeout: 10000,
          });
          
          sf.keyboard.press({
              keys: "return",
          });
          
          1. samuel henriques @samuel_henriques
              2020-10-12 13:56:39.477Z

              Hello Martin,
              try this,

              sf.ui.proTools.windows.whoseTitle.is('Open').first.buttons.whoseTitle.is('Done').first.elementClick({});
              
              sf.ui.proTools.windows.whoseTitle.is('Open').first.elementWaitFor({
                  waitType: "Appear",
              });
              
              sf.ui.proTools.windows.whoseTitle.is('Open').first.buttons.whoseTitle.is('Open').first.elementClick();
          2. M
            In reply toMartin_Pavey:
            Martin Pavey @Martin_Pavey
              2020-10-12 14:54:17.606Z

              Hi Samuel,
              Nope still doesn't work, sorry.
              It's this window I'm trying to wait for while the import audio process bar is running.
              Thanks

              1. samuel henriques @samuel_henriques
                  2020-10-12 14:59:28.389Z

                  cool, was on another import audio.
                  you want always clip list?

                  1. samuel henriques @samuel_henriques
                      2020-10-12 15:07:45.637Z

                      this is for clip list

                      sf.ui.proTools.windows.whoseTitle.is('Audio Import Options').first.elementWaitFor({
                          waitType: "Appear",
                      });
                      
                      sf.ui.proTools.windows.whoseTitle.is('Audio Import Options').first.radioButtons.first.checkboxSet({
                          targetValue: "Enable",
                      });
                      
                      sf.ui.proTools.windows.whoseTitle.is('Audio Import Options').first.buttons.whoseTitle.is('OK').first.elementClick();
                      
                      
                      1. MMartin Pavey @Martin_Pavey
                          2020-10-12 16:12:09.222Z

                          Yes I always use clip list.

                          Ah ha! that works great, thanks for your help on this Samuel and Raphael.

                          Here's the whole thing if anyone else finds it useful.

                          sf.keyboard.press({
                              keys: "cmd+c",
                          });
                          
                          sf.ui.proTools.windows.whoseTitle.is('Open').first.buttons.whoseTitle.is('Done').first.elementClick({});
                          
                          sf.ui.proTools.windows.whoseTitle.is('Open').first.elementWaitFor({
                              waitType: "Appear",
                          });
                          
                          sf.ui.proTools.windows.whoseTitle.is('Open').first.buttons.whoseTitle.is('Open').first.elementClick()
                          
                          sf.ui.proTools.windows.whoseTitle.is('Audio Import Options').first.elementWaitFor({
                              waitType: "Appear",
                          });
                          
                          sf.ui.proTools.windows.whoseTitle.is('Audio Import Options').first.radioButtons.first.checkboxSet({
                              targetValue: "Enable",
                          });
                          
                          sf.ui.proTools.windows.whoseTitle.is('Audio Import Options').first.buttons.whoseTitle.is('OK').first.elementClick();
                          
                          1. MMartin Pavey @Martin_Pavey
                              2020-10-12 16:14:06.975Z

                              Ps..
                              For anyone that doesn't get what it does.
                              You select the file or files in the import window that you want to import and then run the macro.

                              1. samuel henriques @samuel_henriques
                                  2020-10-12 16:30:37.601Z

                                  Cool, happy it works.
                                  I'm used to drag to the session or clip list, but sometimes it will be usefull.

                                  Have fun!

                                  1. In reply toMartin_Pavey:
                                    samuel henriques @samuel_henriques
                                      2020-10-12 16:45:59.383Z

                                      You can do this, using the same trigger.
                                      If the Import audio window is not there it will open in, when its opened, select your files and press again.

                                      if (sf.ui.proTools.windows.whoseTitle.is('Open').first.buttons.whoseTitle.is('Done').exists){
                                      
                                      sf.ui.proTools.windows.whoseTitle.is('Open').first.buttons.whoseTitle.is('Copy ->').first.elementClick();
                                      
                                      sf.ui.proTools.windows.whoseTitle.is('Open').first.buttons.whoseTitle.is('Done').first.elementClick({});
                                      
                                      sf.ui.proTools.windows.whoseTitle.is('Open').first.elementWaitFor({
                                          waitType: "Appear",
                                      });
                                      
                                      sf.ui.proTools.windows.whoseTitle.is('Open').first.buttons.whoseTitle.is('Open').first.elementClick()
                                      
                                      sf.ui.proTools.windows.whoseTitle.is('Audio Import Options').first.elementWaitFor({
                                          waitType: "Appear",
                                      });
                                      
                                      sf.ui.proTools.windows.whoseTitle.is('Audio Import Options').first.radioButtons.first.checkboxSet({
                                          targetValue: "Enable",
                                      });
                                      
                                      sf.ui.proTools.windows.whoseTitle.is('Audio Import Options').first.buttons.whoseTitle.is('OK').first.elementClick();
                                      
                                      }else{
                                          sf.ui.proTools.menuClick({
                                          menuPath: ["File","Import","Audio..."],
                                      });
                                      }
                                      
                                      1. MMartin Pavey @Martin_Pavey
                                          2020-10-12 16:48:55.507Z

                                          Now, that is very cool!
                                          Thanks for that Samuel, I'll give it a try.
                                          M

                                          1. Hey @Samuel this is awesome, I need some help tweaking the ELSE part if you have a free moment. And to be honest I'm sure there's a cleaner way of navigating to the STEMS folder, I'm just not quite up to snuff.

                                            I use Soundminer Radium to sound design all the time, but I need to use the STEMS all the time so my mixer has more flexiblity.
                                            So I've built a script using Christians navigate to session folder command, and then key commands to navigate to the Audio Files folder, then to STEMS folder from there. But when I shove that into the ELSE command it doesn't take.

                                            A. How do I need to format this (because I literally have no idea what I'm doing) to get it to sit in the ELSE part of your script?

                                            B. Is there a cleaner way to navigate to STEMS folder for current session (ie not key presses), it will always be in the Audio Files folder of current session?

                                            C. DREAM SETUP Soundflow knows to grab the last modifed files in the folder (a variable number since there's variable stems per radium build) and import those so this is all on one button press?

                                            Here's my clunky navigate to stems folder Script that's been working but I don't quite get how to get it to live in the }else{ :

                                            sf.ui.proTools.menuClick({
                                            menuPath: ["File","Import","Audio..."],
                                            });

                                            //Calling command "Navigate to Folder of Current Session" from package "Pro Tools Utilities" (installed from user/pkg/version "srAasovvDiQacRZ2mcId4RrOA8R2/ck1w23x1o0000ef10gotnvo1z/cko4vno0300016y10lm312ray")
                                            sf.soundflow.runCommand({
                                            commandId: 'user:ckrzeoq180001b4103nnk3xd9:ck1w41c8u0015ef10kd27lzs8',
                                            props: {}
                                            });

                                            sf.keyboard.press({
                                            keys: "a, u, cmd+down, s, t, e, m, s, cmd+down",
                                            });

                                            1. samuel henriques @samuel_henriques
                                                2021-08-19 18:33:20.003Z

                                                Hello Owen Granich-Young,

                                                it seams to me that you want a script to :
                                                open import audio window
                                                navigate to stems folder
                                                select the latest created

                                                then you could check if selection is correct and press open

                                                what is the normal path and name of the STEMS folder?

                                                In the mean time you can check this video on how to quote code in the forum:
                                                How to quote code in the SoundFlow forum.

                                                Let me know if I didn't understand it well.
                                                I think it's better fi you could open a new thread, What you are asking is fairly different from this one, just so it makes it easier to search in the future.

                                                1. I saw that it didn't quote correclty, I'll check that link out thanks!

                                                  IE: I still know nothing :)

                                                  I'd be happy to skip the check step and have it do it all in one go TBH.

                                                  I'll Make a new thead now and @ you

                                  2. M
                                    In reply toMartin_Pavey:
                                    Martin Pavey @Martin_Pavey
                                      2020-10-12 16:52:25.467Z

                                      I just tried it. Super slick.
                                      Thanks so much.

                                      1. samuel henriques @samuel_henriques
                                          2020-10-12 17:05:49.567Z

                                          Cool!