Click Button Prob - Clicks the Button but doesn't run the script

Hi,

I have a script that creates a new record in Filemaker Pro 11, and when a certain display dialog box comes up with 3 buttons to choose from - the script does a click button to hit the ‘No’ button.

All sounds so simple … !!

Trouble is - it hits the button - and you can see the button go blue as it is clicked - but it doesn’t run the script associated to the button. If you click on the button manually with the mouse cursor - it works fine.

I’ve also tried ‘click at’ system events with the co-ordinates of the button - but with the same result.

Any ideas guys ?

When I hit such wall, I use my good friend ASObjC Runner to solve the problem.


activate application "boring"
tell application "System Events" to tell application process "boring"
set {x,y} to position of the_deaf_button
end
tell application "ASObjC Runner"
click button once at {x+1,y+1}
end

I’m not sure that adding 1 to the two coordinates is useful but it’s an old habit.
The complete description of the command is :
click button‚v : Simulate pressing a mouse button.
click button once/Œtwice/Œright button : The type of click.
[at list of integer] : If specified, the mouse is moved to this location before clicking.
[holding down list of shift/Œoption/Œcommand/Œcontrol] : An optional list of modifier keys to associate with the click. Valid only with single click on left button.

Yvan KOENIG (VALLAURIS, France) mercredi 17 octobre 2012 15:33:59

Thanks for the reply - I’ve still got problems though. I downloaded ‘ASObjC Runner’ as I’ve never used it before.
Version v1.9.8

The script that you sent me won’t compile - it says “Syntax Error - Expected end of line but found identifier” - and highlights ‘button’ after click.

My Applescript version is 2.3 (118)

My OSX is 10.6.8

Any thoughts ?

I apologize but I don’t own Filemaker Pro so I don’t know its buttons names.

I used fake application name and fake button name.
It’s a bit logical that the script can’t compile as is.
As you are already using GUI Scripting, I assumed that you would be able to adjust the code to your application.

Here is an edited code which compile as is but can’t be run because it doesn’t target its action onto a defined window embedding the button.


activate application "Preview"
tell application "System Events" to tell application process "Preview"
	set {x, y} to position of button 1
end tell
tell application "ASObjC Runner"
	click button once at {x + 1, y + 1}
end tell

Yvan KOENIG (VALLAURIS, France) mercredi 17 octobre 2012 19:06:27