Hi,
I have this line of code to click a button on a record in FM11 …
tell application "System Events"
tell process "FileMaker Pro"
click button "MakeNewJob" of window "Job"
end tell
end tell
Trouble is - I don’t actually know the name of the button. What code can I use to find its name ?
The button may not have an Object Name, although it has a label. “GetLayoutObjectAttribute” can give some info. But can you simply use a “do script” to run the script associated with the button instead?
Thanks for the reply - but i have to admit to being pretty clueless one this subject !!
To throw a little more light on what I’m trying to do … we have an MIS system running in FilemakerPro … and within a ‘layout’ or ‘record’, I have this button that has a title “Make New Job” (although I don’t know if thats its real name) - and I want the script to press it (or run the script attached to it).
I have no idea what the button is called - so can’t use a system event to click it - and I don’t know the name of the script attached to it to run it.
I have been trying things like :
tell application “FileMaker Pro”
activate
tell database “Job”
get name of every FileMaker script of current layout
end tell
end tell
but i just get error returns like:
“error “FileMaker Pro got an error: Object not found.” number -1728 from name of every FileMaker script of current layout of database “Job””
Any help would be appreciated - and would help me from tearing out the few hairs I have left on my head !!!
If you have access to Layout mode (Cmd-L), when you double-click on the button it will show what script is attached to it. Then you can “do” it (see below).
If you don’t have access to Layout mode you could get the name of every script this way:
tell application “FileMaker Pro Advanced”
tell window “the window name” – usually the file name without the “.fp7”
return the name of every FileMaker script – look in the Result pane of the Script Editor; you can copy the name from there
end tell
end tell
Once you have the script name:
tell application “FileMaker Pro Advanced”
tell window “the window name”
go to layout "name of correct layout" -- to make sure you're in the right place
do script "name of the script"
end tell
end tell