Clicking on Pop up Alert Button (Apple Remote Desktop)

Hello group:

I have been having a lot of fun learning the ins and outs of AppleScript. I have found myself tied up with an issue that does not seem to be very well documented, or at least I have failed to find the right answer.

I have been trying to get AppleScript to click on an Alert Window that pops up upon an action.

If you are familiar with Apple Remote Desktop, when you are about to send a command, if ARD defines that sending that command will fail in a few machines, it will pop up a window, saying:

This task will fail.

“XXXXXX” is currently offline

and a “Continue” and “Go back” buttons.

I have tried to get the “Continue” Button pressed by using tab, command-Enter, Option-Enter, Control-Enter, etc… but nothing like that works…

Is there a way to get AppleScript to choose the “Continue Button” ?

I tried getting the Command window to use the

set the bounds of the first window to {20, 20, 400, 600}

so I have a predicted area where this button will appear so I can use cliclick to do it. but no joy…

Any help will be appreciated…

Thanks

HT

Here is a script which I use to do this kind of thing.
The main problem is to learn which is the class of the ‘window’ embedding the button to press.
To get this info, I use the good old :

Macintosh HD:Developer:Applications:Utilities:Accessibility Tools:Accessibility Inspector.app:

Sometimes, the button is not in a window but in a sheet.

Here it’s in a window.


--[SCRIPT iTunes-launcher]
(*
Launch iTunes and click the button allowing entering connexions
Yvan KOENIG (VALLAURIS, France)
2011/12/29
*)

activate application "iTunes"
repeat 5 times
	delay 0.1
	try
		tell application "System Events" to tell application process "UserNotificationCenter"
			tell window 1 to click button -2
		end tell
		exit repeat
	on error
		--
	end try
end repeat
--[/SCRIPT]

Yvan KOENIG (VALLAURIS, France) jeudi 29 décembre 2011 17:23:38


Thanks so much!

It really helped me out and got me rolling towards the right direction…

Awesome advice!


tell application “System Events”
tell process “Remote Desktop”
click button “Continue” of sheet 1 of window “Untitled”
end tell
end tell