|
Avid Pro Audio CommunityHow to Join & Post • Community Terms of Use • Help Us Help YouKnowledge Base Search • Community Search • Learn & Support |
#251
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
Here's some simple code to open a PT session with the Finder:
Code:
set mySession to (path to documents folder as text) & "Pro Tools:mySessions:Test_Session.ptx" as text tell application "Finder" to open mySession using application file id "com.avid.ProTools" as alias |
#252
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
Any progress?
|
#253
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
Hi Oliver, thanks for checking in, appreciate it.
Yes, I made some significant progress. The script is still not operational, I am looking to debug it. Current issues: - When I open just one file, the script performs well - When I try opening more than one file, the script wouldn't click Don't Save button. Also sometimes the script wouldn't open Memory Locations - which somehow works for one file I will spend more time debugging the script. Here's the current version for the reference: Code:
property cliclickCLIPath : missing value property shortDelay : 0.1 property medDelay : 0.3 set cliclickCLIPath to "usr/local/bin/cliclick" set theFolders to {} repeat try set theFolders to theFolders & (choose file with prompt "Choose your PT files to bounce. Choose Cancel when finished with all folders" with multiple selections allowed) get theFolders on error display notification "Exiting" exit repeat end try end repeat get theFolders set i to 0 set aRow to 0 set bRow to 0 set mySession to {} repeat with i from 1 to (count of theFolders) set mySession to item i of theFolders tell application "Finder" to open mySession using application file id "com.avid.ProTools" as alias delay shortDelay tell application "System Events" tell process "Pro Tools" try 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 delay shortDelay -- Maximize window click button 10 of mlWindow try -- click "Start" set aRow to row 1 of table "Memory Locations" tell aRow set {xPosition, yPosition} to position set {xSize, ySize} to size my cliClick("c:" & xPosition + (xSize div 2) & "," & yPosition + (ySize div 2)) end tell -- click "End" set b to count of row of table "Memory Locations" set bRow to row b of table "Memory Locations" tell bRow key down {shift} delay shortDelay set {xPosition, yPosition} to position set {xSize, ySize} to size my cliClick("c:" & xPosition + (xSize div 2) & "," & yPosition + (ySize div 2)) key up {shift} end tell 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 -- Press ⌥⌘B tell application "System Events" to key code 11 using {option down, command down} -- Press "Bounce" tell application "System Events" tell process "Pro Tools" try -- HERE TO ADD ALL THE VARIABLES click button "Bounce" of window 1 delay shortDelay keystroke return repeat until exists button "Don't Save" of window 1 end repeat delay shortDelay click button "Don't Save" of window 1 end try end tell end tell -- end repeat end try end tell end tell end repeat on cliClick(process) do shell script quoted form of cliclickCLIPath & " -r " & process end cliClick
__________________
Pro Tools 2019, Hackintosh High Sierra |
#254
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
Hi all,
Looks like I was able to make the first version of the automatic bounce script to work. Here is the code. I will continue debugging it and adding small improvements. Kindly let me know if it's usable on your end. Highly appreciate all your help and attention along the way. Code:
property cliclickCLIPath : missing value property shortDelay : 0.1 property medDelay : 0.3 set cliclickCLIPath to "usr/local/bin/cliclick" set theFolders to {} repeat try set theFolders to theFolders & (choose file with prompt "Choose your PT files to bounce. Choose Cancel when finished with all folders" with multiple selections allowed) get theFolders on error display notification "Exiting" exit repeat end try end repeat get theFolders set i to 0 set aRow to 0 set bRow to 0 set mySession to {} repeat with i from 1 to (count of theFolders) set mySession to item i of theFolders set sessionName to name of (info for mySession) as string set sessionNameTrim to trimText(sessionName, ".ptx", "end") tell application "Finder" to open mySession using application file id "com.avid.ProTools" as alias delay shortDelay tell application "System Events" tell process "Pro Tools" -- TO FINISH HERE - to click Don't Save if PT project is already open if exists button "Don't Save" of window 1 then click button "Don't Save" of window 1 end if if i is not equal to 1 then if not (exists button "Don't Save" of window 1) then repeat until exists button "Don't Save" of window 1 end repeat end if click button "Don't Save" of window 1 end if try set frontmost to true -- Open Memory Locations window if it is not open already if not (exists window "Memory Locations") then repeat until exists window "Memory Locations" click menu item "Memory Locations" of menu "Window" of menu bar item "Window" of menu bar 1 -- key code 87 using {command down} delay shortDelay end repeat end if -- Set variable for Memory Locations window set mlWindow to (1st window whose name contains "Memory Locations") -- Maximize Memory Locations window for script to be able to click on each marker delay shortDelay tell mlWindow delay shortDelay -- Maximize window click button 10 of mlWindow try -- click "Start" set aRow to row 1 of table "Memory Locations" tell aRow set {xPosition, yPosition} to position set {xSize, ySize} to size my cliClick("c:" & xPosition + (xSize div 2) & "," & yPosition + (ySize div 2)) end tell -- click "End" set b to count of row of table "Memory Locations" set bRow to row b of table "Memory Locations" tell bRow key down {shift} delay shortDelay set {xPosition, yPosition} to position set {xSize, ySize} to size my cliClick("c:" & xPosition + (xSize div 2) & "," & yPosition + (ySize div 2)) key up {shift} end tell 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 -- Press ⌥⌘B tell application "System Events" to key code 11 using {option down, command down} -- Press "Bounce" tell application "System Events" tell process "Pro Tools" try -- HERE TO ADD ALL THE VARIABLES -- Change name of bounced file to Session Name Trim set bField to text field 1 of window 1 tell bField delay shortDelay set {xPosition, yPosition} to position set {xSize, ySize} to size my cliClick("c:" & xPosition + (xSize div 10) & "," & yPosition + (ySize div 2)) key code 0 using {command down} keystroke sessionNameTrim end tell click button "Bounce" of window 1 delay shortDelay keystroke return -- Wait until bounce finishes repeat until (static text "Bouncing..." of window 1 exists) end repeat repeat until not (static text "Bouncing..." of window 1 exists) end repeat end try end tell end tell end try end tell end tell end repeat if i is equal to (count of theFolders) then tell application "System Events" tell process "Pro Tools" key code 13 using {shift down, command down} repeat until exists button "Don't Save" of window 1 end repeat click button "Don't Save" of window 1 end tell end tell end if on cliClick(process) do shell script quoted form of cliclickCLIPath & " -r " & process end cliClick on trimText(theText, theCharactersToTrim, theTrimDirection) set theTrimLength to length of theCharactersToTrim if theTrimDirection is in {"beginning", "both"} then repeat while theText begins with theCharactersToTrim try set theText to characters (theTrimLength + 1) thru -1 of theText as string on error -- text contains nothing but trim characters return "" end try end repeat end if if theTrimDirection is in {"end", "both"} then repeat while theText ends with theCharactersToTrim try set theText to characters 1 thru -(theTrimLength + 1) of theText as string on error -- text contains nothing but trim characters return "" end try end repeat end if return theText end trimText
__________________
Pro Tools 2019, Hackintosh High Sierra |
#255
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
Hi Michael,
this looks promising. 👍 I will check it out as soon as my time allows. I am usually pretty busy around this time of the year, sorry about that. Quote:
|
#256
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
HI everybody
FIRST A big thank you for all the contributions.... Really nice.... i 'm in the begin of my apllescript adventure. and thank of you i understand more and more. BUT i try to make a script for select the menu by criteria in soundfiled recording. it's ok BUT the end of the script is very very slow juste to do 3 key code action.... i don't understand. maybe you can help me. here is the script Code:
activate application "Pro Tools" tell application "System Events" tell application process "Pro Tools" set window_name to name of front window -- key code for copy paste key code 8 using {command down} key code 41 key code 9 using {command down} -- click pop up button for track P1 click pop up button 1 of group "P1 - Audio Track " of window window_name -- type e for select expand channels and by criteria -- PROBLEM THE SRCIPT VERY VERY LONG TIME TO DO THE NEXT STEP key code 14 key code 124 key code 36 end tell end tell best ps : sorry for my beautifull PERFECT english |
#257
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
Quote:
See post #226 for a solution. 😉 |
#258
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
Hi
thank for the Good reply you ve solved the problem Code:
property cliclickCLIPath : missing value set cliclickCLIPath to "usr/local/bin/cliclick" activate application "Pro Tools" tell application "System Events" tell application process "Pro Tools" set window_name to name of front window -- key code for copy paste keystroke "c" using command down keystroke "m" keystroke "v" using command down -- click pop up button for track P1 tell pop up button 1 of group "temoin - Audio Track " of window window_name -- type e for select expand channels and by criteria set {xPosition, yPosition} to position set {xSize, ySize} to size my cliClick("rc:" & xPosition + (xSize div 2) & "," & yPosition + (ySize div 2)) key code 14 key code 124 key code 36 end tell end tell end tell on cliClick(coordinate) do shell script quoted form of cliclickCLIPath & " -r " & coordinate end cliClick By the way how can we access to the Group id... and for the pop menu of right click what is the way to select menu directly. like hide for example on the right click of track. Thank you Oliver. best |
#259
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
Hi
thank for the Good reply i've solve the problem Code:
property cliclickCLIPath : missing value set cliclickCLIPath to "usr/local/bin/cliclick" activate application "Pro Tools" tell application "System Events" tell application process "Pro Tools" set window_name to name of front window -- key code for copy paste keystroke "c" using command down keystroke "m" keystroke "v" using command down -- click pop up button for track P1 tell pop up button 1 of group "temoin - Audio Track " of window window_name -- type e for select expand channels and by criteria set {xPosition, yPosition} to position set {xSize, ySize} to size my cliClick("rc:" & xPosition + (xSize div 2) & "," & yPosition + (ySize div 2)) key code 14 key code 124 key code 36 end tell end tell end tell on cliClick(coordinate) do shell script quoted form of cliclickCLIPath & " -r " & coordinate end cliClick By the way how can we access to the Group id... and for the pop menu of right click what is the way to select menu directly. like hide for example on the right click of track. Thank you Oliver. best |
#260
|
|||
|
|||
Re: Automation AppleScripts for Pro Tools (Mac)
Hi
thank for the Good reply i've (...you) solve the problem Code:
property cliclickCLIPath : missing value set cliclickCLIPath to "usr/local/bin/cliclick" activate application "Pro Tools" tell application "System Events" tell application process "Pro Tools" set window_name to name of front window -- key code for copy paste keystroke "c" using command down keystroke "m" keystroke "v" using command down -- click pop up button for track P1 tell pop up button 1 of group "temoin - Audio Track " of window window_name -- type e for select expand channels and by criteria set {xPosition, yPosition} to position set {xSize, ySize} to size my cliClick("rc:" & xPosition + (xSize div 2) & "," & yPosition + (ySize div 2)) key code 14 key code 124 key code 36 end tell end tell end tell on cliClick(coordinate) do shell script quoted form of cliclickCLIPath & " -r " & coordinate end cliClick it search because UIElementInspector find it and it's workx with axshowmenu but.....lose here is my first failled script Code:
tell application "System Events" tell application process "Pro Tools" set window_name to name of front window click pop up button 1 of group "a - zik (VZIK)" of window window_name--a - zik (VZIK) is the name of my group end tell end tell the UIElementInspector result <AXApplication: “Pro Tools”> <AXWindow: “Edit: Copie de EDIT OPJ S1 EP44 TO EDIT JF - 12”> <AXTable: “Group List”> <AXRow> <AXCell> <AXButton: “a - zik (VZIK)”> Attributes: AXRowIndexRange: “pos=1 len=1” AXIdentifier: “1164199792:ELEM:1:1” AXEnabled: “1” AXFrame: “x=22 y=513 w=383 h=11” AXVisibleChildren: “(null)” AXParent: “<AXCell>” AXChildren: “(null)” AXFocused: “1” AXTitleUIElement: “(null)” AXColumnIndexRange: “pos=1 len=1” AXRole: “AXButton” AXTopLevelUIElement: “(null)” AXSelectedChildren: “(null)” AXAuditIssues: “(null)” AXHelp: “(null)” AXTitle: “a - zik (VZIK)” AXValue: “a - zik (VZIK)” AXWindow: “(null)” AXRoleDescription: “bouton” AXSubrole: “(null)” AXSize: “w=383 h=11” AXPosition: “x=22 y=513” Actions: AXShowMenu - Afficher le menu AXPress - appuyer and for the pop menu of right click what is the way to select menu directly. like hide for example on the right click of track. Thank you . best Last edited by oudi; 12-10-2019 at 05:03 AM. |
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 |