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.
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
There are also explanations here Finding the file path for an open document in Audacity
But I can’t make it work either.
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:
- In Pro Tools open a project so that it has an open window.
- Make sure the project window is frontmost in Pro Tools.
- Paste the AppleScript below to a new document in Script Editor (/Applications/Utilities/Script Editor.app).
- 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.
- 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
Thanks! Will try
Sadly I get
System Events got an error: Can’t get application process “”.
You have to put the name of the Pro Tools process in-between the quotation marks in the script (replacing the
tell application "System Events" tell application process "<Pro Tools>" tell window 1 get value of attribute "AXDocument" end tell end tell end tell
Actually my mistake…I get
If you don't mind, I will follow the course with you
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 ?
OK. Assuming you have used the correct process name and a project window was open, then this is bad news.
But in the result of Script editor.app, I get:
(with this text file of course)
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.
Appreciate you trying!
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.
Tom, you were right! KM macro works now like a charm. Not with Photoshop so far (what I was looking for).
The QXP extension is from Quark XPress and the app is deinstalled.
Oh, yes. I forgot to write that I did remove it of course, else it wouldn’t work.
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