trying to have System Events dismiss an alert in FileMaker Pro; can't

Those familiar with FileMaker Pro and databases hosted on FileMaker Server might have the same pain of the occasional “communication interruption” that FMP can’t seem to self-recover from.

I was hoping I could use AppleScript to dismiss this dialog so I could then re-launch my database, however so far the dismissing of the dialog seems to not work, though Script Debugger doesn’t report to me an error.

My script…

tell application "System Events"
	set frontmost of process "FileMaker Pro Advanced" to true
	tell process "FileMaker Pro Advanced"
		click button 1 of window 1
	end tell
end tell

But the dialog does not get dismissed. Can anyone help? Thanks.

Wouldn’t work for me either, but what about this? Can you at that point just forcibly quit FileMaker and then relaunch and open the database?

GUI scripting is always a matter of luck.

Sometimes click doesn’t work, but perform action “AXPress” of does, sometimes none of it.
Unfortunately there is no standard how UI elements behave,

I tried force-quitting Applescript methods I found online but they didn’t help, but I’m sure the most-likely problem was me and my inexperience.

I tried the AXPress option too, it didn’t seem to always work but it does seem to when I put it into a repeat loop. Seems to work somewhere in there. :slight_smile:

tell application "System Events"
	set frontmost of process "FileMaker Pro Advanced" to true
	tell process "FileMaker Pro Advanced"
		if exists button "OK" of window 1 then
			repeat while exists button "OK" of window 1
				if exists button "OK" of window 1 then
					perform action "AXPress" of button "OK" of window 1
				end if
			end repeat
		end if
	end tell
end tell

Thank you so much for the suggestion.

I recently discovered this to make an error dialog box active so I could use system events to do a keystroke to clear it. Don’t know if it will help but it’s worth a try.


try
	tell application "UserNotificationCenter"
		activate
	end tell
end try
delay 2
tell application "System Events"
	keystroke "o" using {command down}
	keystroke return
	keystroke "." using {command down}
end tell