Clock.app stop timer

How can I press the Done button of a timer in Clock.app with AppleScript?

I’m trying to kill the timer at a certain time. It could even be via Terminal if that’s possible.

Here is the script. It is bug ridden to get to the correct button. Don’t ask why.

tell application "System Events"
	tell application process "Clock"
		if (value of radio button 4 of radio group 1 of group 1 of toolbar 1 of window 1) as boolean then -- "Timer" is chosen
			if enabled of button 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of window "Clock" then
				click button 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of group 1 of window "Clock"
			end if
		end if
	end tell
end tell
1 Like