Avid Pro Audio Community

Avid Pro Audio Community

How to Join & Post  •  Community Terms of Use  •  Help Us Help You

Knowledge Base Search  •  Community Search  •  Learn & Support


Avid Home Page

Go Back   Avid Pro Audio Community > Pro Tools Software > Tips & Tricks

Reply
 
Thread Tools Search this Thread Display Modes
  #221  
Old 09-16-2019, 12:48 AM
TrentWilliams TrentWilliams is offline
Member
 
Join Date: Aug 2012
Location: Wellington, New Zealand
Posts: 811
Default Re: Automation AppleScripts for Pro Tools (Mac)

Thanks for all your help with this!

It really makes a difference to my workflow, and I'm hugely appreciative.

Is it possible to add a stop-check in the situation where I'm editing/typing the name of a track?

For instance. Stop/cancel the script if the text enter dialog window is open?
__________________
Pro Tools 2019.6|Ultimate, UAD Apollo 8, UAD Octo+Quad Satellite, UAD Apollo Twin Quad Core, Focusrite 8PreXiMac 27" Late 2013 - 3.5GHz i7 - macOS 10.14.4 • RAM 32GB DDR3, GPU NVidia GTX 780M 4GB
Reply With Quote
  #222  
Old 09-16-2019, 01:06 AM
henningaround henningaround is offline
Member
 
Join Date: Feb 2012
Location: Cologne, Germany
Posts: 77
Default Re: Automation AppleScripts for Pro Tools (Mac)

Quote:
Originally Posted by TrentWilliams View Post
Thanks for all your help with this!



It really makes a difference to my workflow, and I'm hugely appreciative.



Is it possible to add a stop-check in the situation where I'm editing/typing the name of a track?



For instance. Stop/cancel the script if the text enter dialog window is open?
Since I use all the script with Keyboard Maestro I can cancle all macros of KM with a shortcut. If you use the scripts directly I don't know how to do this.
Reply With Quote
  #223  
Old 09-16-2019, 03:42 AM
Oliver M Oliver M is offline
Member
 
Join Date: Dec 1969
Location: Europe
Posts: 963
Default Re: Automation AppleScripts for Pro Tools (Mac)

Quote:
Originally Posted by TrentWilliams View Post
Thanks for all your help with this!

It really makes a difference to my workflow, and I'm hugely appreciative.

Is it possible to add a stop-check in the situation where I'm editing/typing the name of a track?

For instance. Stop/cancel the script if the text enter dialog window is open?
You should not stop or cancel the script when you want further actions to be completed by the script after you renamed the track, instead you'd let the script wait for a certain action to be completed, like when having the track rename window open you let the script wait until that window closes/doesn’t exist anymore.

But you should explain your entire workflow in order to get detailed help. What did the script do before the track rename window opens, what should be done when you have entered the new track name and pressed the OK button and so on. The more detailed the question the better the answer. 😉
Reply With Quote
  #224  
Old 09-17-2019, 02:36 AM
TrentWilliams TrentWilliams is offline
Member
 
Join Date: Aug 2012
Location: Wellington, New Zealand
Posts: 811
Default Re: Automation AppleScripts for Pro Tools (Mac)

Quote:
Originally Posted by Oliver M View Post
You should not stop or cancel the script when you want further actions to be completed by the script after you renamed the track, instead you'd let the script wait for a certain action to be completed, like when having the track rename window open you let the script wait until that window closes/doesn’t exist anymore.

But you should explain your entire workflow in order to get detailed help. What did the script do before the track rename window opens, what should be done when you have entered the new track name and pressed the OK button and so on. The more detailed the question the better the answer. ��
Hey Oliver, thanks again for all your help.

The script is working fine, it's just when I go to enter text and need numerics it triggers my KM hotkey. (I know I could change my hotkey, but) I was thinking it might be possible to use the script to tell KM to check prior to firing if there is a text box open?

I'm trying to figure out applescripts - *I missed out on learning anything like this in school, a little before my time unfortunately.

Starting with something simple, I've been trying to select the "Clip by Clip" pop up button of the "Processing Input Mode" menu item. But I keep getting a kick back telling me I can't access that item.

Here's what I've got. If you have a minute, I would really appreciate any guidance or insight into what I can do to improve. I installed Xcode to run the Accessibility Inspector because I thought that might help me.


Quote:
tell application "Pro Tools"
activate
tell application "System Events"
tell process "Pro Tools"
click menu item "RX 7 Connect" of menu 1 of menu item "iZotope, Inc." of menu "AudioSuite" of menu bar 1
click pop up button "Clip by Clip" of pop up button "Processing Input Mode"

end tell
end tell
end tell
Basically I just want to be able to run a script with KM that opens RX 7 Connect Audiosuite, and sets it to "Individual Files" and "Clip By Clip".

I thought If I could get it to change to "Clip by Clip" at least I'll be half way there .. but I can't even do that. haha
__________________
Pro Tools 2019.6|Ultimate, UAD Apollo 8, UAD Octo+Quad Satellite, UAD Apollo Twin Quad Core, Focusrite 8PreXiMac 27" Late 2013 - 3.5GHz i7 - macOS 10.14.4 • RAM 32GB DDR3, GPU NVidia GTX 780M 4GB

Last edited by TrentWilliams; 09-17-2019 at 02:53 AM.
Reply With Quote
  #225  
Old 09-17-2019, 03:07 AM
henningaround henningaround is offline
Member
 
Join Date: Feb 2012
Location: Cologne, Germany
Posts: 77
Default Re: Automation AppleScripts for Pro Tools (Mac)

I do this by setting variables in KM (Plug-In, Preset, Processing Input Mode, Processing Output Mode), giving them to AppleScript and let AppleScript do the clicks with "cliClick" (which was mentioned by Oliver before).

You need some conditions to be checked e.g. is the AudioSuite already opened, which preset and processing modes are set etc.
Reply With Quote
  #226  
Old 09-17-2019, 05:46 AM
Oliver M Oliver M is offline
Member
 
Join Date: Dec 1969
Location: Europe
Posts: 963
Default Re: Automation AppleScripts for Pro Tools (Mac)

Trent,

the following reply was prepared offline, before you edited your post and thus is based on the content of your former version.

Quote:
Originally Posted by TrentWilliams
The script is working fine, it's just when I go to enter text and need numerics it triggers my KM hotkey. I know I could change my hotkey, but I was thinking it might be possible to use the script to tell KM to check prior to firing if there is a text box open, or engaged?
This is something to be fixed within KM. I would rather change the hotkey.

Quote:
Originally Posted by TrentWilliams
Starting with something simple, I've been trying to select the "Clip by Clip" pop up button of the "Processing Input Mode" menu item. But I keep getting a kick back telling me I can't access that item.

Here's what I've got. If you have a minute, I would really appreciate any guidance or insight into what I can do to improve. I installed Xcode to run the Accessibility Inspector because I thought that might help me.

Code:
tell application "System Events"
	tell process "Pro Tools"
		set frontmost to true
		if exists (window "AudioSuite") then click (menu item "Processing Input Mode" whose description is "Clip by Clip")
	end tell
end tell
What are you trying to achieve is not possible with plain AppleScript because Pro Tools isn’t scriptable! When you are using AppleScript with Pro Tools you are scripting the user interface of Pro Tools (a.k.a. GUI scripting), not the Pro Tools app itself.

Try this:

Code:
property shortDelay : 0.1

if ptIsRunning() then
	tell application "System Events"
		tell process "Pro Tools"
			set frontmost to true
			tell (1st window whose name contains "Audio Suite")
				try
					-- click button "Processing Input Mode"
					click pop up button "Processing Input Mode"
					delay shortDelay
					key code 126 -- Arrow up key / Selects the "clip by clip" option
					delay shortDelay
					keystroke return
					
				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
end if

on ptIsRunning()
	return application "Pro Tools" is running
end ptIsRunning
Since this introduces the 6 second delay again (after opening the "Processing Input Mode" menu item) you should use cliclick instead.

Assuming cliclick is installed in usr/local/bin:

Code:
property cliclickCLIPath : missing value
property shortDelay : 0.1

set cliclickCLIPath to "usr/local/bin/cliclick"

if ptIsRunning() then
	tell application "System Events"
		tell process "Pro Tools"
			set frontmost to true
			set asWindow to (1st window whose name contains "Audio Suite")
			try
				tell asWindow
					-- click button "Processing Input Mode"
					tell pop up button "Processing Input Mode"
						set {xPosition, yPosition} to position
						set {xSize, ySize} to size
						my cliClick("c:" & xPosition + (xSize div 2) & "," & yPosition + (ySize div 2))
					end tell
				end tell
				delay shortDelay
				key code 126 -- Arrow up key / Selects the "clip by clip" option
				delay shortDelay
				keystroke return
				
			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 if

on ptIsRunning()
	return application "Pro Tools" is running
end ptIsRunning

on cliClick(coordinate)
	do shell script quoted form of cliclickCLIPath & " -r " & coordinate
end cliClick
Reply With Quote
  #227  
Old 09-19-2019, 08:09 PM
echoesoflife echoesoflife is offline
Member
 
Join Date: Aug 2019
Location: Melbourne, Australia
Posts: 10
Default

Dear Community and Oliver,

First of all, thanks for sharing your knowledge in this fantastic thread. I was able to follow it and start building my scripts purely based on this information, very helpful indeed.

Now, I am a little bit stuck and would love to kindly ask for your advice on the following issue.

I am working on Auto-Bounce program for Pro Tools. Essentially I aim to write a script which:
- Opens Memory Locations window for the PT project
- Clicks marker that has "Start" title
- Shift-clicks marker that has "End" title
- Bounces the project

This is the bare bones of the script, I will make some additions to it once it's working.

So far, everything in the script works apart from the Shift-click. I tried cliclick, I tried Apple Script modifiers and somehow I can't get Shift modifier to work.

Here is the part of the code where Shift modifier doesn't work:

Code:
--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
			tell asWindow
				do shell script "usr/local/bin/cliclick kd:shift"
			
				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
				
				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
			
			do shell script "usr/local/bin/cliclick ku:shift"
	
		end try
	end tell
end tell
Please note that for some reason the forum itself wouldn't let me post the correct command for cliclick, there is a / symbol before usr in my original code.

Last edited by echoesoflife; 09-19-2019 at 08:10 PM. Reason: Problems with posting on the forum
Reply With Quote
  #228  
Old 09-20-2019, 12:47 AM
henningaround henningaround is offline
Member
 
Join Date: Feb 2012
Location: Cologne, Germany
Posts: 77
Default Re: Automation AppleScripts for Pro Tools (Mac)

Quote:
Originally Posted by echoesoflife View Post
Dear Community and Oliver,

First of all, thanks for sharing your knowledge in this fantastic thread. I was able to follow it and start building my scripts purely based on this information, very helpful indeed.

Now, I am a little bit stuck and would love to kindly ask for your advice on the following issue.

I am working on Auto-Bounce program for Pro Tools. Essentially I aim to write a script which:
- Opens Memory Locations window for the PT project
- Clicks marker that has "Start" title
- Shift-clicks marker that has "End" title
- Bounces the project

This is the bare bones of the script, I will make some additions to it once it's working.

So far, everything in the script works apart from the Shift-click. I tried cliclick, I tried Apple Script modifiers and somehow I can't get Shift modifier to work.

Here is the part of the code where Shift modifier doesn't work:

Code:
--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
tell asWindow
do shell script "usr/local/bin/cliclick kd:shift"

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

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

do shell script "usr/local/bin/cliclick ku:shift"

end try
end tell
end tell
Please note that for some reason the forum itself wouldn't let me post the correct command for cliclick, there is a / symbol before usr in my original code.
Maybe you can avoid this by using a memory locations with a selection which always has the number 999. So you can locate to it by hitting ,999, on the keypad (inside your script).
Reply With Quote
  #229  
Old 09-20-2019, 02:41 AM
Oliver M Oliver M is offline
Member
 
Join Date: Dec 1969
Location: Europe
Posts: 963
Default Re: Automation AppleScripts for Pro Tools (Mac)

Quote:
Originally Posted by echoesoflife View Post
...
Here is the part of the code where Shift modifier doesn't work:
...
Quote:
Originally Posted by henningaround View Post
Maybe you can avoid this by using a memory locations with a selection which always has the number 999. So you can locate to it by hitting ,999, on the keypad (inside your script).
echoesoflife,

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
The Memory Locations window doesn't even have to be open for this to work.

Keep in mind that you should wrap the key down and up commands in a try block as those keys can get stuck!
Reply With Quote
  #230  
Old 09-20-2019, 03:12 AM
echoesoflife echoesoflife is offline
Member
 
Join Date: Aug 2019
Location: Melbourne, Australia
Posts: 10
Default Re: Automation AppleScripts for Pro Tools (Mac)

Thank you kindly! I'll give it a try and will report back then.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pro Tools 12 Trim Automation bleu@cheerful.com Pro Tools 12 2 08-16-2015 05:25 AM
Pro Tools 11.2.1 Automation Bug?! Gneal550 Pro Tools 11 1 11-22-2014 02:15 PM
GRM tools automation bug? D'Animation Pro Tools TDM Systems (Mac) 6 10-08-2014 09:21 AM
scripting Pro Tools; automation Bermaster 003, Mbox 2, Digi 002, original Mbox, Digi 001 (Mac) 12 10-01-2004 01:38 PM
AppleScripts and other Macros for PT Bergeron Tips & Tricks 1 11-15-1999 07:55 PM


All times are GMT -7. The time now is 11:19 PM.


Powered by: vBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Limited. Forum Hosted By: URLJet.com