Macro run from AppleScript command in Filemaker not working properly

I have a macro that is working perfectly using the “Try” button directly from KM. I am trying to run the macro using the “Run AppleScript” Script command from inside Filemaker and copying the AppleScript steps from KM.

It opens the Macro and start to run it. First the Macro opens safari and logs into a webpage. That part works great. For some reason the macro can’t pull the Filemaker window back up with the Activate Application Action. I can see that Filemaker becomes active on the top Menu Bar, however, it doesn’t pull up the application. Again, the macro runs perfect directly from KM.

Any suggestions?

It seems that when I run an apple script from Filemaker. I can’t target the Filemaker application until the Macro completes. Is there a way around this?

A post was split to a new topic: Cheat Sheet: Using File Maker Pro (FMP) with KM and AppleScript

Troy, thank you this is very helpful. This looks like a much better method of moving data over to KM.

I am executing the AppleScript the way that you suggested i.e. copying it from KM.

Just out of curiosity though do you know a way of activating the filemaker application again to perform mouse clicks before the AppleScipt completes?

Maybe if you post your macro, I could be of more help.

macro steps could possibly be:
1- perform applescript
2- activate application Filemaker Pro
3- perform clicks

This is the AppleScript that KM gives me.

-- ignoring application responses
tell application "Keyboard Maestro Engine"
	do script "CC22AC1E-8FFC-44D1-B1EA-787603688E99"
	-- or: do script "IOU - Personal"
	-- or: do script "CC22AC1E-8FFC-44D1-B1EA-787603688E99" with parameter "Whatever"
end tell

When I run this from Filemaker it starts the macro. My macro Opens Safari and logs into a website. It then switched to the Filemaker Application and clicks on some items in a window.

The problem is that the Macro get's an error when trying to go back to Filemaker and click on on something in a filemaker window because Filemaker is still waiting for the AppleScript to complete.

I can defiantly see that using AppleScript to get data from Filemaker is a much better method but I'm just curious if there's a way to get back to Filemaker and work with it using Interface Control Actions instead of AppleScipt?

ah, I had issues with this, it could be that filemakers original AppleScript is waiting for a response from KM.

delete the 2 dashes in front of
– ignoring application responses and
– end ignoring

this will tell AppleScript to not wait for a response

ignoring application responses
tell application "Keyboard Maestro Engine"
do script “CC22AC1E-8FFC-44D1-B1EA-787603688E99”
– or: do script “IOU - Personal”
– or: do script “CC22AC1E-8FFC-44D1-B1EA-787603688E99” with parameter "Whatever"
end tell
end ignoring

Eureeka!! That worked perfectly, thank you so much for the help on this.

I have now implemented the AppleScript techniques that you outlined above and the entire process now takes 1/4 of the time to complete :smile:

It’s defiantly worth knowing how to get these done with both of these methods.

For others that may view this post, one thing that I noticed in my solution to get it working… Make sure that you remember to include the table name in the Apple Script

So for this script to work with mine

--AS VARIABLE FROM FMP FIELD
tell application "FileMaker Pro Advanced"
set First_Name to cell named "First Name" of current record as text
end tell

I had to add the table name like this. (Merchants::First Name is the name of the field so yours will likely be a different name)

–AS VARIABLE FROM FMP FIELD
tell application "FileMaker Pro Advanced"
set First_Name to cell named “Merchants::First Name” of current record as text
end tell

@troy, I hope you don’t mind that I have moved your FMP Cheat Sheet to the “Tips & Tutorials” category:
###Cheat Sheet: Using File Maker Pro (FMP) with KM and AppleScript

This looks like valuable info that many users could benefit from.
Thanks for posting.

Please feel free to edit your post that I moved.

1 Like