Click location on 1st Window

Hello,

First off, very new to scripting but I’m starting to get the basics. That being said I’ve run into a problem where a window that pops up when I click the menu item needs to be clicked in a specific location on the window. It’s not a button or text so I’m trying to just click at a location on the window that pops up. When I try to use click {x,y}, I get the error Can’t get 176. Access not allowed. My script is below. I’ve been using a combo of Accessibility Inspector and UI Browser for seeing what can be scriptable in Pro Tools. I’ve also tried using click at {x,y} of (1st window) but I get the same error. Any help is greatly appreciated. I’ve already learned a lot from this forum.

Thanks in advanced!

tell application “System Events”

-- Check if Pro Tools is running
if exists (process "Pro Tools") then
	
	tell process "Pro Tools"
		
		if exists (window "Audio Suite: RX 7 Connect") then
			--do nothing if window is already open
		else
			set frontmost to true
			click menu item "RX 7 Connect" of menu "Noise Reduction" of menu item "Noise Reduction" of menu "AudioSuite" of menu bar item "AudioSuite" of menu bar 1
			delay 0.5
                           --THIS IS WHERE MY ERROR OCCURS. WHEN I GET THE ERROR MESSAGE IT HIGHLIGHTS TITLE. 
			click at {176, 296} of (1st window whose title contains "RX 7 Connect")
			
		end if
	end tell
	
else
	
	-- Disable the following line if you don't want the dialog to pop up
	display dialog "Pro Tools is not open."
	
end if

end tell

I can’t test but you may try :


tell application "System Events"
	
	-- Check if Pro Tools is running
	if exists (process "Pro Tools") then
		
		tell process "Pro Tools"
			set frontmost to true
			if exists (window "Audio Suite: RX 7 Connect") then
				--do nothing if window is already open
			else
				set frontmost to true
				click menu item "RX 7 Connect" of menu "Noise Reduction" of menu item "Noise Reduction" of menu "AudioSuite" of menu bar item "AudioSuite" of menu bar 1
				set knt to 0
				repeat
					if exists (window 1 whose title contains "RX 7 Connect") then exit repeat -- isn't it "Audio Suite: RX 7 Connect" ?
					delay 0.1
					set knt to knt + 1
					if knt = 10 then
						error "there is no window whose title contains “RX 7 Connect”!"
					end if
				end repeat
				
				--THIS IS WHERE MY ERROR OCCURS. WHEN I GET THE ERROR MESSAGE IT HIGHLIGHTS TITLE. 
				-- click at {176, 296} of (1st window whose title contains "RX 7 Connect") -- this original instruction refuse to compile
				tell (first window whose title contains "RX 7 Connect") to click at {176, 296} -- Here is a valid syntax
			end if
		end tell
		
	else
		
		-- Disable the following line if you don't want the dialog to pop up
		display dialog "Pro Tools is not open."
		
	end if
	
end tell

Yvan KOENIG running High Sierra 10.13.6 in French (VALLAURIS, France) jeudi 16 avril 2020 21:27:23

It was a long time ago - last year. :frowning: Then it turned out that Pro Tools does not work with click at. He needs to move the mouse really over the position before clicking - the mouse tool (for example, mouseTools or cliClick). This means that Pro Tools is written by developer this way that each element of window is invisible for System Events until the mouse is over the element.

So, instead of click at of System Events, use mouse tool to click at your position. This should work.