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
  #271  
Old 05-08-2020, 04:32 AM
Oliver M Oliver M is offline
Member
 
Join Date: Dec 1969
Location: Europe
Posts: 1,008
Default Re: Automation AppleScripts for Pro Tools (Mac)

Quote:
Originally Posted by sicijk View Post
But how can I know which is that button number for every plugin?
Check this out UI Browser or use Apple's Accessibility Inspector, an old app now part of Xcode.
A standalone version can be found somewhere on Apple's Developer servers.
Reply With Quote
  #272  
Old 05-08-2020, 04:53 AM
Oliver M Oliver M is offline
Member
 
Join Date: Dec 1969
Location: Europe
Posts: 1,008
Default Re: Automation AppleScripts for Pro Tools (Mac)

Quote:
Originally Posted by oudi View Post
hi
the problem is the button 1 is not each time the close button...it depand of the plug
and it's not AudioSuite but Audio Suite.
for example
for the channel strip plug the close button is the 11




Code:
activate application "Pro Tools"
tell application "System Events"
    tell process "Pro Tools"
        tell (every window whose name contains "Audio Suite") to click button 11 -- Close button
    end tell
 end tell
and button 9 for normalize plug....
Exactly! 😉
Some years ago -when Avid introduced these changes-, I updated my own personel script so that it reads the close button ID's from a property list. I haven't updated it for a while but it should work up until PT 2019.12 at least.

Code:
--	Close Every AudioSuite Window in Pro Tools

--	This script closes every open AudioSuite plug-in in Avid Pro Tools.


--	Version History:

--	v4.0:	Due to code changes in Pro Tools 12.8.2 AudioSuite plug-in close buttons no longer use the static index ID 1 but inconsistent IDs. Because of this the ID of an open AS plug-in window's close button will be picked from a property list.

--	v3.0:	Minimum requirements for this version are macOS 10.12 or higher, Pro Tools 12.7 or higher.
--			Got rid of old code for older OS and PT versions.
--			Added a check to determine if there is actually an AudioSuite window open (dummy check).

--	v2.2:	Minor code changes.

--	v2.1:	Minor code changes.		

--	v2.0:	Turned AppleScript into an AppleScript Bundle.

--	v1.0:	For personal use only.


--  Copyright (c) 2014-2017 Oliver Momm. All rights reserved.

property shortDelay : 0.1
property medDelay : 0.3
property longDelay : 0.5
property xtralongDelay : 1

property buttonData : {{name:"C4 Stereo", identifier:11}, ¬
	{name:"C6 Stereo", identifier:11}, ¬
	{name:"Channel Strip", identifier:11}, ¬
	{name:"D-Verb", identifier:12}, ¬
	{name:"DC Offset Removal", identifier:9}, ¬
	{name:"DeEsser Stereo", identifier:11}, ¬
	{name:"Devil-Loc Deluxe", identifier:11}, ¬
	{name:"Doubler2 Stereo", identifier:11}, ¬
	{name:"Doubler4 Stereo", identifier:11}, ¬
	{name:"Duplicate", identifier:10}, ¬
	{name:"Elixir v3 - 1 Stage", identifier:11}, ¬
	{name:"Elixir v3", identifier:11}, ¬
	{name:"EQ3 1-Band", identifier:11}, ¬
	{name:"EQ3 7-Band", identifier:11}, ¬
	{name:"Gain", identifier:7}, ¬
	{name:"GRM BandPass", identifier:11}, ¬
	{name:"GRM CombFilter", identifier:11}, ¬
	{name:"GRM Contrast", identifier:11}, ¬
	{name:"GRM Delays", identifier:12}, ¬
	{name:"GRM Doppler", identifier:11}, ¬
	{name:"GRM Equalize", identifier:11}, ¬
	{name:"GRM Freeze", identifier:11}, ¬
	{name:"GRM PitchAccum", identifier:11}, ¬
	{name:"GRM Reson", identifier:11}, ¬
	{name:"GRM Shift", identifier:11}, ¬
	{name:"GRM Shuffling", identifier:12}, ¬
	{name:"GRM Warp", identifier:11}, ¬
	{name:"HoRNetSongKeyMK2", identifier:11}, ¬
	{name:"Invert", identifier:10}, ¬
	{name:"IRCAM Tools - T.R.A.X. CS v3", identifier:11}, ¬
	{name:"IRCAM Tools - T.R.A.X. SF v3", identifier:11}, ¬
	{name:"IRCAM Tools - T.R.A.X. Tr. v3", identifier:11}, ¬
	{name:"iZotope DDLY", identifier:12}, ¬
	{name:"iZotope RX 5 Connect", identifier:10}, ¬
	{name:"iZotope RX 5 De-click", identifier:11}, ¬
	{name:"iZotope RX 5 De-clip", identifier:11}, ¬
	{name:"iZotope RX 5 De-crackle", identifier:11}, ¬
	{name:"iZotope RX 5 De-hum", identifier:11}, ¬
	{name:"iZotope RX 5 De-noise", identifier:11}, ¬
	{name:"iZotope RX 5 De-reverb", identifier:11}, ¬
	{name:"iZotope RX 5 Dialogue De-noise", identifier:11}, ¬
	{name:"L1+ Ultramaximizer Stereo", identifier:11}, ¬
	{name:"L2 Stereo", identifier:11}, ¬
	{name:"Lo-Fi", identifier:11}, ¬
	{name:"LoAir Stereo", identifier:11}, ¬
	{name:"Massenburg Design Works EQ5 3 Bands", identifier:11}, ¬
	{name:"Massenburg Design Works EQ5 5 Bands", identifier:11}, ¬
	{name:"MetaFilter Stereo", identifier:12}, ¬
	{name:"MetaFlanger Stereo", identifier:11}, ¬
	{name:"Mod Delay III", identifier:12}, ¬
	{name:"MondoMod Stereo", identifier:11}, ¬
	{name:"Normalize", identifier:5}, ¬
	{name:"Oxford Dynamics Full", identifier:11}, ¬
	{name:"Oxford Dynamics Surround", identifier:11}, ¬
	{name:"Oxford Envolution", identifier:11}, ¬
	{name:"Oxford EQ+Filters", identifier:11}, ¬
	{name:"Oxford Inflator", identifier:11}, ¬
	{name:"Oxford Limiter", identifier:11}, ¬
	{name:"Oxford Reverb", identifier:12}, ¬
	{name:"Oxford SuprEsser HighRes", identifier:11}, ¬
	{name:"Oxford SuprEsser LowLatency", identifier:11}, ¬
	{name:"Oxford SuprEsser", identifier:11}, ¬
	{name:"Oxford TransMod", identifier:11}, ¬
	{name:"Pitch 'n Time Pro", identifier:12}, ¬
	{name:"Pitch II", identifier:11}, ¬
	{name:"Pitch Shift Legacy", identifier:11}, ¬
	{name:"Pro Limiter Loudness Analyzer", identifier:11}, ¬
	{name:"Q10 Stereo", identifier:11}, ¬
	{name:"Recti-Fi", identifier:11}, ¬
	{name:"Reverse", identifier:10}, ¬
	{name:"S1 Imager Stereo", identifier:11}, ¬
	{name:"S1 MS Matrix Stereo", identifier:11}, ¬
	{name:"S1 Shuffler Stereo", identifier:11}, ¬
	{name:"SA2 Dialog Processor", identifier:11}, ¬
	{name:"Sci-Fi", identifier:11}, ¬
	{name:"Signal Generator", identifier:11}, ¬
	{name:"Space", identifier:12}, ¬
	{name:"SuperTap 6-Taps Stereo", identifier:12}, ¬
	{name:"Time Compression Expansion", identifier:9}, ¬
	{name:"Time Shift", identifier:11}, ¬
	{name:"Vari-Fi", identifier:10}}

set finderIconPath to (path to library folder from system domain as text) & "CoreServices:Finder.app:Contents:Resources:Finder.icns"
set ptIconPath to (path to applications folder as text) & "Pro Tools.app:Contents:Resources:ProTools.icns"

if not osVersionCheck("10.12") then
	-- Display error message
	try
		activate application "Pro Tools"
		tell application "Pro Tools" to display dialog return & "This script requires macOS 10.12 or higher." & return with icon file finderIconPath buttons {"Cancel"} default button "Cancel"
	on error errorMessage number errorNumber
		if errorNumber = -1712 then -- If script times out
			return true
			
		else if errorNumber = -128 then -- If user cancels script
			return true
			
		else
			tell application "Pro Tools" to display alert "Error: " & the errorNumber & ": " message the errorMessage buttons {"OK"} default button "OK"
		end if
	end try
	
	activate application "Pro Tools"
	
else
	try
		if ptVersionCheck("12.8.2") then
			activate application "Pro Tools"
			tell application "System Events"
				tell process "Pro Tools"
					-- Check if an AudioSuite plug-in window is open
					if not (exists (every window whose name contains "Audio Suite")) then
						-- Do nothing
						
					else
						set asWindows to (get windows whose name contains "Audio Suite")
						repeat with aWindow in asWindows
							set windowName to name of aWindow
							set {TID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, ": "}
							set plugInName to text item 2 of windowName
							set AppleScript's text item delimiters to TID
							set buttonID to my identifierFor(plugInName)
							if buttonID is -1 then
								-- Display error message
								try
									tell application "Pro Tools"
										activate
										display alert "Plug-in " & plugInName & " not supported" message "Please, contact the author of this script." buttons {"OK"} default button "OK"
									end tell
								on error errorMessage number errorNumber
									if errorNumber = -1712 then -- If script times out
										return true
									end if
								end try
								
							else
								tell aWindow to click button buttonID
							end if
						end repeat
					end if
				end tell
			end tell
			
		else
			-- Display error message
			try
				tell application "Pro Tools"
					activate
					display alert "Incompatible Pro Tools Version" message "This action requires Pro Tools 12.8.2 or higher." buttons {"Cancel"} default button "Cancel"
				end tell
			on error errorMessage number errorNumber
				if errorNumber = -1712 then -- If script times out
					return true
				end if
			end try
		end if -- ptVersionCheck		
	end try
end if -- osVersionCheck

on ptVersionCheck(referenceVersion)
	set proToolsVersion to version of application "Pro Tools"
	considering numeric strings
		return (proToolsVersion as text) is greater than or equal to referenceVersion
	end considering
end ptVersionCheck

on osVersionCheck(referenceVersion)
	set osVersion to system version of (system info)
	considering numeric strings
		return (osVersion as text) is greater than or equal to referenceVersion
	end considering
end osVersionCheck

on identifierFor(buttonName)
	repeat with aRecord in buttonData
		if aRecord's name is buttonName then return aRecord's identifier
	end repeat
	return -1
end identifierFor

Download compiled script.
Reply With Quote
  #273  
Old 06-27-2020, 09:36 AM
oudi oudi is offline
Member
 
Join Date: Jun 2007
Posts: 13
Default Re: Automation AppleScripts for Pro Tools (Mac)

hi

i've found a solution for close any open audio suite


Code:
tell application "System Events"
    tell application process "Pro Tools"
        set frontmost to true
        try
            set plug to first window whose title contains "Audio Suite:"
        on error
            display alert " No Audio suite open"
            return
        end try
        set f to get subrole of button of plug
    end tell
end tell

set closeBtnPos to getPositionOfItemInList("AXCloseButton", f)
tell application "System Events"
    click button closeBtnPos of plug
end tell


on getPositionOfItemInList(theItem, theList)
    repeat with a from 1 to count of theList
        if item a of theList is theItem then return a
    end repeat
    return 0
end getPositionOfItemInList
so happy
enjoy

Last edited by oudi; 06-27-2020 at 09:58 AM.
Reply With Quote
  #274  
Old 06-29-2020, 04:35 AM
Oliver M Oliver M is offline
Member
 
Join Date: Dec 1969
Location: Europe
Posts: 1,008
Default Re: Automation AppleScripts for Pro Tools (Mac)

Quote:
Originally Posted by oudi View Post
hi

i've found a solution for close any open audio suite


Code:
tell application "system events"
    tell application process "pro tools"
        set frontmost to true
        try
            set plug to first window whose title contains "audio suite:"
        on error
            display alert " no audio suite open"
            return
        end try
        set f to get subrole of button of plug
    end tell
end tell

set closebtnpos to getpositionofiteminlist("axclosebutton", f)
tell application "system events"
    click button closebtnpos of plug
end tell


on getpositionofiteminlist(theitem, thelist)
    repeat with a from 1 to count of thelist
        if item a of thelist is theitem then return a
    end repeat
    return 0
end getpositionofiteminlist
so happy
enjoy
👍
Reply With Quote
  #275  
Old 08-23-2020, 10:03 AM
Javier Fracchia Javier Fracchia is offline
Member
 
Join Date: Jan 2017
Location: Buenos Aires, Argentina
Posts: 4
Default Re: Automation AppleScripts for Pro Tools (Mac)

How are you?
I am very new to this and I am somewhat dizzy.
I'm trying to use the master keyboard to be able to select a channel and activate or deactivate a specific insert number (eg Bypass insert 7).
It's possible?
And is it possible having pro tools in Spanish and with the mixer view always in front?
Thanks!!
Reply With Quote
  #276  
Old 08-26-2020, 07:21 AM
Oliver M Oliver M is offline
Member
 
Join Date: Dec 1969
Location: Europe
Posts: 1,008
Default Re: Automation AppleScripts for Pro Tools (Mac)

Quote:
Originally Posted by Javier Fracchia View Post
How are you?
I am very new to this and I am somewhat dizzy.
I'm trying to use the master keyboard to be able to select a channel and activate or deactivate a specific insert number (eg Bypass insert 7).
It's possible?
And is it possible having pro tools in Spanish and with the mixer view always in front?
Thanks!!
Hi Javier,

yes, this can be done. See henningaround's post #211 on page 22 and post #218. Instead of clicking the button Insert_to_open you should control-click it with Cliclick.

Unfortunately I don't speak Spanish. Please, have a look at UI Browser and check if it supports Spanish GUI elements in Pro Tools.
Reply With Quote
  #277  
Old 09-19-2020, 06:04 AM
simonyeah simonyeah is offline
Member
 
Join Date: May 2010
Posts: 96
Default Re: Automation AppleScripts for Pro Tools (Mac)

Hello to all,

I am face to a problem with a script I am using on Protools 2020.3 that works perfectly but for a reason does not work with Protools 2018.3.

The script is made to open the output window of the selected track. It goes as follows :

tell application "System Events"

if exists (process "Pro Tools") then

tell process "Pro Tools"

tell (1st window whose title contains "Edit: ")

set selectedTrack to title of button of UI element 2 of (1st row of table "Track List" whose selected is true)

set formattedString to text of selectedTrack as string
set AppleScript's text item delimiters to "Selected. "
set theTextItems to every text item of formattedString
set AppleScript's text item delimiters to ""
set formattedString to theTextItems as string

click button "Output Window button" of group "Audio IO" of group formattedString

end tell
end tell
end if
end tell


On the machine with Protools 2018.3, it does not work and I have this message :

Error Number: -1728

System Events got an error: Can’t get group "Selected Audio 2 audio track" of window 1 of process "Pro Tools" whose title contains "Edit: ".


Anyone could help?

Many thanks in advance,

Simon
Reply With Quote
  #278  
Old 09-21-2020, 03:27 PM
Oliver M Oliver M is offline
Member
 
Join Date: Dec 1969
Location: Europe
Posts: 1,008
Default Re: Automation AppleScripts for Pro Tools (Mac)

simonyeah,

2018.3 is a pretty old version. I am on macOS 10.14.6 and I am not sure if this is a supported OS for this PT version.
I cannot test this myself at the moment.

The error message looks like the group "Selected Audio 2 audio track" cannot be resolved. What differences do you see in UI Browser if you compare the script in a working version of PT and the troublesome 2018.3?
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 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


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


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