Pick Up Path of Folder for Macro - Pro Tools


#1

I'm a Post Audio Mixer using Pro Tools. Have a request to create a KB Macro to pick up the path of the current project I'm working on. For exporting files Pro Tools defaults to last folder it used. I want it to default or go to the "Bounced Files" folder of the project I'm currently working on. Hoping for ideas on how to get Mac to give me the path to my project. I know if I command-click on top of window I can see path but wondering how to best get that into a step in a KB macro. Thanks for any ideas.


#2

Trying to help you, I have found this:

(applescript to copy the path of the frontmost window)

  • the fact that the well known command shift G keyboard shortcut of the Finder works in Save Dialog Box too!

Unfortunately I can’t make this work. Mostly because I don’t know a damn thing about AppleScript


#3

There are also explanations here Finding the file path for an open document in Audacity
But I can’t make it work either.


#4

I have never used Pro Tools, but according to this post it is not scriptable with AppleScript. If that is true, then it means you would have to resort to GUI scripting.

In this respect @irep has given you a good hint with the topic he has found, in particular this post:

To see if it works for you, do this:

  1. In Pro Tools open a project so that it has an open window.
  2. Make sure the project window is frontmost in Pro Tools.
  3. Paste the AppleScript below to a new document in Script Editor (/Applications/Utilities/Script Editor.app).
  4. In the script replace the <process name> with the Pro Tools process name.
  • To find the process name, open /Applications/Utilities/Activity Monitor.app, and look for the exact process name in the list.
  1. Run the script and see what it returns.
tell application "System Events"
  tell application process "<process name>"
    tell window 1
      get value of attribute "AXDocument"
    end tell
  end tell
end tell

#5

Thanks! Will try


#6

Sadly I get

System Events got an error: Can’t get application process “”.


#7

You have to put the name of the Pro Tools process in-between the quotation marks in the script (replacing the <process name>).


#8

I did…

tell application "System Events"
   tell application process "<Pro Tools>"
      tell window 1
         get value of attribute "AXDocument"
      end tell
   end tell
end tell

#9

Actually my mistake…I get

missing value


#10

If you don't mind, I will follow the course with you :slight_smile:

When I try this last applescript directly in KM and applied to an already saved text file, I get error too.

Why is this world so cruel ?

Thank you.


#11

OK. Assuming you have used the correct process name and a project window was open, then this is bad news.


#12

But in the result of Script editor.app, I get:

“file:///Users/Me/Desktop/a%CC%80%20jeter/code-in-cache-page.txt”
(with this text file of course)


#13

According to the error message you have an incompatible ScriptingAddition installed. Try to update it.

A very similar problem is troubleshooted in the posts here.


#14

Appreciate you trying!


#15

It’s not the same if you launch a script with osascript (which is what KM uses) or with Script Editor. Apparently Script Editor is more tolerant.

But this is not related to the Pro Tools thingy. Not every app responds to the accessibility attributes like “AXDocument”. See the topic which you have linked to.


#16

@rpalagy, let’s hope there are Pro Tools users on the forum who can help you.


#17

Tom, you were right! KM macro works now like a charm. Not with Photoshop so far (what I was looking for).
Thank you.
The QXP extension is from Quark XPress and the app is deinstalled.


#18

Then I would delete it. You should find it in one of these folders.


#19

Oh, yes. I forgot to write that I did remove it of course, else it wouldn’t work.


#20

For fully scriptable apps you don’t need GUI/accessibility scripting.

In TextEdit you can get the document path with this:

tell application "TextEdit"
  path of document 1
end tell

In Photoshop (CS6):

tell application "Adobe Photoshop CS6"
  file path of document 1
end tell