|
Avid Pro Audio CommunityHow to Join & Post • Community Terms of Use • Help Us Help YouKnowledge Base Search • Community Search • Learn & Support |
#231
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
Quote:
Quote:
what Henning wrote is the easiest solution. If you want to pick specific Memory Locations (i.e. Start is marker #1 and End is marker #999) you can do it like that: Code:
property shortDelay : 0.1 property medDelay : 0.3 tell application "System Events" tell process "Pro Tools" set frontmost to true -- Select Marker #1 - Top key code 65 -- , key keystroke "1" key code 65 delay medDelay -- Extend selection to Marker #999 - End try key down {shift} delay shortDelay key code 65 keystroke "999" key code 65 delay shortDelay key up {shift} end try end tell end tell Keep in mind that you should wrap the key down and up commands in a try block as those keys can get stuck! |
#232
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
Thank you kindly! I'll give it a try and will report back then.
|
#233
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
Hi all,
The shift modifier still doesn't work. Everything else is spot on, the script correctly selects the markers and proceeds to click all the buttons. However the Shift is not held down, hence the selection is not made. I am wondering if I have missed a particular setting for System Events to respond to that command? Weirdly enough, in Settings - Security & Privacy - Privacy I have System Events, Automator and even the particular script enabled. Any pointers would be greatly appreciated! |
#234
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
Try using just one memory location with a selection so you don't need a shift click.
|
#235
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
Quote:
|
#236
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
Thank you Oliver.
Here's the current version of my complicated Memory Location selection. I see the script clicking on markers correctly, but the Shift is not engaged during the process. Interestingly enough, today I am experiencing Shift being engaged after the script has finished. Even though it is wrapped around try code. When I am trying the version of the selection that you have suggested, the script would not click on any of the markers. It is worth noting that I am using a Hackintosh system, and I am on High Sierra. Thanks again for your time! Code:
property shortDelay : 0.1 on doWithTimeout(uiScript, timeoutSeconds) set endDate to (current date) + timeoutSeconds repeat try run script "tell application \"System Events\" " & uiScript & " end tell" exit repeat on error errorMessage if ((current date) > endDate) then error "Can not " & uiScript end if end try end repeat end doWithTimeout activate application "Pro Tools" set timeoutSeconds to 0.2 -- Click the “Window” menu. delay 0.4 set uiScript to "click menu bar item \"Window\" of menu bar 1 of application process \"Pro Tools\"" my doWithTimeout(uiScript, timeoutSeconds) -- Memory Locations delay 0.5 set uiScript to "click menu item \"Memory Locations\" of menu \"Window\" of menu bar item \"Window\" of menu bar 1 of application process \"Pro Tools\"" my doWithTimeout(uiScript, timeoutSeconds) end run --selection of markers from Start to End script tell application "System Events" tell process "Pro Tools" set asWindow to (1st window whose name contains "Memory Locations") try key down {shift} tell asWindow -- click "Start" repeat with aRow in row of table "Memory Locations" if name of static text of UI element 2 of aRow starts with "Start" then click static text "Start" of UI element 2 of aRow end repeat -- click "End" delay shortDelay repeat with aRow in row of table "Memory Locations" if name of static text of UI element 2 of aRow starts with "End" then click static text "End" of UI element 2 of aRow end repeat end tell delay shortDelay key up {shift} on error e number n tell application "Pro Tools" to display alert "An Error Occurred" message e & " (" & n & ")" buttons {"Cancel"} default button 1 end try end tell end tell -- Press ⌥⌘B delay 0.5 set uiScript to "keystroke \"∫\" using {option down, command down}" my doWithTimeout(uiScript, timeoutSeconds) -- Click the “Offline” checkbox. set uiScript to "click checkbox \"Offline\" of window \"Bounce\" of application process \"Pro Tools\"" -- Click the “Bounce” button. set uiScript to "click UI Element \"Bounce\" of window \"Bounce\" of application process \"Pro Tools\"" my doWithTimeout(uiScript, timeoutSeconds) -- Click the “OK” button. set uiScript to "click UI Element \"OK\" of window \"MP3\" of application process \"Pro Tools\"" end run Last edited by echoesoflife; 09-22-2019 at 10:11 PM. |
#237
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
Quote:
|
#238
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
Thanks Oliver.
Yes, indeed. I did try your suggestion, and the markers are not getting selected. Here's the code that I tried: Code:
property shortDelay : 0.1 on doWithTimeout(uiScript, timeoutSeconds) set endDate to (current date) + timeoutSeconds repeat try run script "tell application \"System Events\" " & uiScript & " end tell" exit repeat on error errorMessage if ((current date) > endDate) then error "Can not " & uiScript end if end try end repeat end doWithTimeout activate application "Pro Tools" set timeoutSeconds to 0.2 --selection of markers from Start to End script property medDelay : 0.3 tell application "System Events" tell process "Pro Tools" set frontmost to true -- Select Marker #1 - Top key code 65 -- , key keystroke "1" key code 65 delay medDelay -- Extend selection to Marker #999 - End try key down {shift} delay shortDelay key code 65 keystroke "999" key code 65 delay shortDelay key up {shift} end try end tell end tell -- Press ⌥⌘B delay 0.5 set uiScript to "keystroke \"∫\" using {option down, command down}" my doWithTimeout(uiScript, timeoutSeconds) -- Click the “Offline” checkbox. set uiScript to "click checkbox \"Offline\" of window \"Bounce\" of application process \"Pro Tools\"" -- Click the “Bounce” button. set uiScript to "click UI Element \"Bounce\" of window \"Bounce\" of application process \"Pro Tools\"" my doWithTimeout(uiScript, timeoutSeconds) -- Click the “OK” button. set uiScript to "click UI Element \"OK\" of window \"MP3\" of application process \"Pro Tools\"" end run
__________________
Pro Tools 2019, Hackintosh High Sierra |
#239
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
echoesoflife,
here is a combination of cliclick and the key down and up commands that does what you want (it clicks the actual markers by name). I also added some code to check whether the Memory Locations window is open and if not opens it. This works flawlessly here. Code:
property cliclickCLIPath : missing value property shortDelay : 0.1 property medDelay : 0.3 set cliclickCLIPath to "usr/local/bin/cliclick" tell application "System Events" tell process "Pro Tools" set frontmost to true -- Open Memory Locations window if it is not open already if not (exists window "Memory Locations") then click menu item "Memory Locations" of menu "Window" of menu bar item "Window" of menu bar 1 repeat until exists window "Memory Locations" delay shortDelay end repeat end if -- Set variable for Memory Locations window set mlWindow to (1st window whose name contains "Memory Locations") delay shortDelay tell mlWindow try -- Click "Start" marker repeat with aRow in row of table "Memory Locations" if name of static text of UI element 2 of aRow starts with "Start" then tell static text "Start" of UI element 2 of aRow set {xPosition, yPosition} to position set {xSize, ySize} to size my cliClick("c:" & xPosition + (xSize div 2) & "," & yPosition + (ySize div 2)) end tell end if end repeat -- Click "End" marker and extend selection repeat with aRow in row of table "Memory Locations" if name of static text of UI element 2 of aRow starts with "End" then tell static text "End" of UI element 2 of aRow set {xPosition, yPosition} to position set {xSize, ySize} to size key down {shift} my cliClick("c:" & xPosition + (xSize div 2) & "," & yPosition + (ySize div 2)) key up {shift} end tell end if end repeat on error e number n tell application "Pro Tools" to display alert "An Error Occurred" message e & " (" & n & ")" buttons {"Cancel"} default button 1 end try end tell end tell end tell on cliClick(process) do shell script quoted form of cliclickCLIPath & " -r " & process end cliClick Last edited by Oliver M; 09-24-2019 at 07:01 AM. Reason: Corrected/added a few comments. |
#240
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
Works like a charm, thanks kindly!
I am going to finish the script into a little app where you could select Online/Offline Bounce, Bounce location and select a few projects to bounce. Once I am done, I will share the source code and the app here.
__________________
Pro Tools 2019, Hackintosh High Sierra |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Pro Tools 12 Trim Automation | [email protected] | Pro Tools 12 | 2 | 08-16-2015 04:25 AM |
Pro Tools 11.2.1 Automation Bug?! | Gneal550 | Pro Tools 11 | 1 | 11-22-2014 01:15 PM |
GRM tools automation bug? | D'Animation | Pro Tools TDM Systems (Mac) | 6 | 10-08-2014 08:21 AM |
scripting Pro Tools; automation | Bermaster | 003, Mbox 2, Digi 002, original Mbox, Digi 001 (Mac) | 12 | 10-01-2004 12:38 PM |
AppleScripts and other Macros for PT | Bergeron | Tips & Tricks | 1 | 11-15-1999 06:55 PM |