Over the latter part of lockdown I decided to pick up AppleScript (AS) and begin integrating that with Keyboard Maestro (KM). I'm sure any real programmers would laugh reading that, in the same way a snobby audiophile would laugh at a pair of KRK Rokits. The fact of both matters is that it's getting the job done, and I'm enjoying the process of learning something relatively simple, yet new and challenging.
The idea is for a user to open a Pro Tools template (VO or ADR), and run a macro in KM which will prompt the user to enter various parts of data such as session start time and the appropriate record data for the character name, cue number, etc. The character data and cue number will be written to the record track name plate, following naming conventions/workflows written in EdiCue/EdiPrompt user manuals and documentation. Of course, the track name could be changed from the start, and later down the line, it will be renamed throughout the session (dictated by this program) to match the cue number that is being recorded.
This requires the track name object reference to be a variable from the get-go. Leaving something like this:
As anyone will know when trying to do any amount of UI scripting, it's frustrating at times. Small details such as " - Audio Track " (with spaces either side) when referring to a named track in Pro Tools (e.g. "Audio 1 - Audio Track ") are easily missed and will render an error at some point during the run.
For Pro Tools users out there, you'll know to rename a track it's either a "Right-click > Rename..." or double-click on the track nameplate. Now, pop-up menus (like the one that appears after a right-click) are bastards to try and access when UI scripting as they don't technically exist until they have been called. This means I had to go for the double-click jobby.
Little did I know, I can't directly write a double-click command in AS (that I know of). "perform action "AXPress"" wouldn't work either; that just gives me the same result as a right-click. Back to square one.
I briefly looked at Python to perform the double-click, but that's been added to 'that' folder. For now, I can tell KM to double click at the centre of the name plate for me. This is done by finding the object's top left corner, then adding half its size to this pixel location for x and y.
That's roughly where we're at at some point. It all works so far and it's taking the focus off of perpetual existentialism.