Trigger KBM macro from FileMaker Pro


Biannual idiot question from longtime but basic user.

I click a button in FMP that runs a simple FMP script, the last step of which is supposed to call KM.

In FMP19.4 I'm telling the target application
to send the event with:

Script text:

ignoring application responses
tell application "Keyboard Maestro"
do script "beeeep"
end tell
end ignoring

Which I pinched from a routine I found here (thank you). No variables, no nothing tricky.
What happens when I run the FMP script otherwise successfully is that KM Engine opens to the editing window rather than running the 'beeeep' script.

Any help appreciated; thanks in anticipation.

I'm not very good with AppleScript, but most of my AppleScript actions say,

tell application "Keyboard Maestro Engine"

while yours says,

tell application "Keyboard Maestro"

which I think means the editor. That might explain your problem.

But we can give much better advice if you actually post a screenshot (or an upload) of the actual macro rather than just describing in your own words what you are doing.

1 Like

Thanks Sleepy. I've tried it both ways; same result. But here's that screenshot. Appreciate your time.

Oh, I see. I thought you were using AppleScript within KM. But you are using "Script Workspace" in FileMaker Pro. If FMP has online documentation I'm willing to read it, but I couldn't the any documentation online, so you may have to wait for someone else here who owns FileMaker Pro to tell you how to use that product.

1 Like

The AppleScript should definitely be tell application "Keyboard Maestro Engine", not "Keyboard Maestro".

Aside from that, one idea that comes to mind is the number of "e"s in beeeep might not be consistent with the macro's name, so you may want to try running the macro by UDID instead. The easiest way I can think of to implement both suggestions is to go to the macro in question, click the "Or by script" dropdown:

CleanShot 2021-11-28 at 20.39.43@2x

Click the "Or by AppleScript option," copy the script as shown in the resulting text field, and paste that into your FMP script in place of the one you're using now:

1 Like

Perhaps it could also be the permissions/flags on the group that his macro is stored in (could it be disabled?) He hasn't shown us that. Or potentially also it could be the triggers/flags on the macro, which he hasn't shown us either.

Or how about that he hasn't turned on the KM Engine? Technically, it could be that too. :flushed:

Of course, he also has to fix the problem that he's calling the Editor rather than the Engine.

1 Like

In FMP 19 I’m using the ‘open URL’ scrip step.


"kmtrigger://macro=AAB1AFF8-4D14-4F93-ABDD-220AE8C94774&value=" & T01_ACCOUNTS::Name_Full

That will trigger the macro with that UUID and carry the data that is in the Name_Full field from the stated table.

Hope that helps.

I do use FMP exchanging data with KM quite regularly using AppleScript and/or the open URL command.

I can look at my AppleScript basic format tomorrow and post if you would like.

Also see:

Cheat Sheet: Using File Maker Pro (FMP) with KM and AppleScript

1 Like

Thanks Sleepy. I thought I was using AppleScript too: see – that's how little I know. More than happy to use AS and if you know the syntax for a script that just says 'tell KM to run a particular macro' with no variables then I'd be pleased to use it – thanks a lot!!

My skills are pretty limited too. I'm just brave enough to try to answer questions that I don't know much about, and at least 50% of the time I'm able to get an answer. The wizards on this forum probably run with an answer rate of 90% or higher, so you're not getting the best possible answers when I help you. :wink:

It seems to me that your app, FMP, has an editor that lets you edit and run true AppleScript code. So I think you are using AS. What I said was that "I thought you were using AS within KM." I wasn't questioning whether you were using AS, just which environment you were using it in.

As I said earlier, and someone confirmed, you definitely have a mistake because you are missing the word "Engine". Please reread that post and fix that problem. Do you know the difference between the KM Engine and the KM Editor? Can you validate that your Engine is running? You can validate it by looking for its symbol in the System Menu on the top right of your screen. It looks like a KM logo.

You also should show us the permissions on the group containing the KM macro that you are calling. If the permissions are not right, it may not run. Can you either show us a snapshot of the group or upload the macro in its current group so we can validate it?

1 Like

gg thanks for this. I wonder if this looks right to you. Please note that because the FMP popup at the bottom of the script window doesn't allow the selection of 'Keyboard Maestro Engine' (as it appears not to exist as a selectable app) I selected the nearest match – just plain ole 'Keyboard Maestro' but I tried all permutations of both before my original post. Thanks too for the tutorial. It still doesn't work (in this case just beep) from FMP unless I use the 'try' button or the convoluted hotkey when it's fine. Any advice appreciated.

Everything else I've been doing in KM from 2009 to date is working, and the macro is enabled. Thanks again.

Hello Troy. Thanks for this. I'm going to try to try it now. Thanks for the cheat sheet which I'll try to a) understand and b) put to good use. Thanks!

Okay. I will assume that you meant the group was enabled, since I was asking about that.

Sorry for any misunderstanding I've launched. I don't reckon I need any scripting in KM frankly – just in FMP to trigger KM. I have explained the engine bit elsewhere (no difference) and all other KM functions are normal. Appreciate your bravery (and self-deprecation :)…

And I'm not processing these replies fast enough for them not to overlap – excuse me. Slow all round, right? Will go and try troy's URL approach now.

Thanks all

Everything is fine. I truly enjoy helping people, and that is its own reward. But I'm not perfect, and I don't think anyone is. If I'm ever wrong, please forgive me.

The thing beeps. It actually beeps. So it'll work when I make it do something meaningful.
troy: thank you. All – thank you. I'll leave you in peace for now.
My occasional trips here are always really positive. Wish I could do something for you lot; maybe one day I'll discover something brilliant :slight_smile:

1 Like

One thing you could do to help us is show us the working solution.

1 Like

Well okay then. Give me a couple of days and that I will. Oh – not sure about the protocol for the heart/like thing but I've been thumping it like crazy for y'all. Thanks again, UK out for now…