No internet connection
  1. Home
  2. How to

How to export out of Pro Tools, process it and re-import it

By Judson Crane @Judson_Crane
    2022-03-04 03:09:52.103Z

    Hi -
    I'm looking to export something from PT, open it with a different app, process it, and re-import it back into PT. I've laid out the process and it all seems easily automatiable, if I can figure out how to code it :-D most of it is just keystrokes.
    I've successfully created a "new script" and located the code for targetting the selected track right click menu (PT)... and that works!
    My questions:

    1. for the following commands, do i have to stay in "script" mode, or can I return to a drag and drop / action based build?
    2. If I have to stay in script mode, I can use this code for simple keystrokes right?
      sf.keyboard.press({ keys: 'cmd+s' });
    3. How do I target a different app with keystrokes, or better yet tell the other app what file to open? (I have the filename in my clipboard at this point in the process).

    I think those questions are a good place to start anyway.
    Thanks for any guidance!

    • 4 replies
    1. Hi Judson,

      You can use the "Activate App's Main Window" macro action to activate an app. This will ensure it's the recipient of any keystrokes sent.

      To learn how to write scripts, any macro action can be converted to Javascript. Click the three small dots in the header of the action - or convert the entire macro to a script (click Convert to Script in the toolbar) and copy/paste.

      I'd also recommend checking out these tutorial videos to learn how to use UI automation as much as possible instead of keyboard/mouse simulation, because it'll let you make more stable macros/scripts:

      1. J
        In reply toJudson_Crane:
        Judson Crane @Judson_Crane
          2022-03-04 16:03:06.658Z

          Thank you! Got as far as getting the MIDI file out and saved properly. Working on the second half next and will give those vids another look.
          So best practice here is to create a "Test Macro" you can switch back and forth to add actions and copy the javascript from? Perhaps would be a nice feature to allow a command to be added directly to your current script as java.
          Powerful stuff! Got the iPad up and running as a deck full of stock commands like loading plugins and track presets. Thanks for the help-

          1. J
            In reply toJudson_Crane:
            Judson Crane @Judson_Crane
              2022-03-04 16:18:24.754Z

              I'm wanting to get Digital Performer to process the exported MIDI. How to get DP to find the file I just exported from PT? I've tried "pasting" the clipboard of the filename into the search box of the DP open window but I get an OS error beep when doing that (even manually without a script). I think after this step the rest is pretty straight forward. Maybe there is a way I can use SoundFlow to open this new .mid file with the DP app that doesn't include the open command in DP? maybe something from this thread?
              Open a File from Project Path
              essentially I have ****.mid (the name is in the clipboard) exported from PT, and now I want to open that with DP. Perhaps a variable can be set up that is the .mid filename and then it can also be used for reimporting into PT?

              my script thus far is:

              sf.soundflow.runCommand({
                  commandId: 'user:ckp49i4j60000a2100yfwywgf:ckou1qcq6009wzv108n39uknd',
                  props: {}
              });
              
              sf.keyboard.press({ keys: 'cmd+c' });
              sf.keyboard.press({ keys: 'esc' });
              sf.ui.proTools.selectedTrack.titleButton.popupMenuSelect({
                  isRightClick: true,
                  menuPath: ['Export MIDI...']
              });
              sf.keyboard.press({ keys: 'return' });
              sf.wait({
                  intervalMs: 700,
              });
              sf.keyboard.press({ keys: 'cmd+v' });
              sf.keyboard.press({ keys: 'return' });
              sf.ui.app('com.motu.DigitalPerformer').appActivateMainWindow();
              
              1. J
                In reply toJudson_Crane:
                Judson Crane @Judson_Crane
                  2022-03-04 16:38:22.928Z

                  perhaps this code? Can I use a variable path / filename within this? (current session folder path, and the variable filename would be the name of the MIDI file...

                  sf.file.open({
                      path: "/Volumes/PROJECTS/DP MIDI export test/export midi test1.mid",
                      applicationPath: "/Applications/Digital Performer.app",
                  });