KM8 issue: TriggerValue (file) is empty

I’ve had a queue-type setup using Hazel and Keyboard Maestro that I set up a couple of years ago — almost exactly like the various situations described below:

As of the day I upgraded to Keyboard Maestro 8.0 (and subsequently 8.0.1), however, the %TriggerValue% (a file) is consistently empty. The Hazel command is simply:

do script "8BCEBEBC-7D7E-4557-AE49-42D06ED3A5A5" with parameter theFile

I’m at my wits’ end trying to figure this one out. Any thoughts?

I just tried:

tell application "Keyboard Maestro Engine"
	do script "088520CE-CA97-4082-A073-8D5412345678" with parameter "testing"
end tell

Where “testing” in quotes is somehow a file?

I just tried that here, but get the same result: nothing is being passed at all.

No changes to Hazel (current version) or the OS (macOS 10.12.6) here; only KM.

The parameter must be a string. For a file parameter, you’ll want the posix path of the file.

Try just using the quoted string and verify that gets passed to the macro, and then work backwards from there, figuing out how to get an appropriate string to pass to the parameter field.

I’ll give that a shot, thanks.

Funny it’s been working perfectly for the last two years, though.

Can you post the complete script where this is an issue?
You shown only one line here:

You say that is a “Hazel” command. It looks like part of a AppleScript script.

Hi, yeah — sorry to be unclear.

Hazel calls the Keyboard Maestro script via AppleScript; the AppleScript is what I posted. Here’s the screen shot from Hazel which should show it clearly.

As you can see, Hazel instructs me to use simply theFile as the parameter to send to KM, and that worked perfectly till the KM8 upgrade.

Aw, snap! Bad coding on my part.


I have two KM scripts involved: the second (really complicated one) that does all the actual work, and the first, a controller script that handles semaphores and pausing and looping.

Here’s the first, which is coded correctly:

It picks up %TriggerValue% and brings it into the T60__Source_dirpath variable.

The goof was in the second script, which begins:

I pick up %TriggerValue% again. Obviously, in KM7 this wasn’t a problem — but KM8 clearly cleans out the %TriggerValue% either after I access it in T61 or when I then execute T60. This is good — but exposed my bad code.

Removing the spurious Set variable reference to %TriggerValue% solved the problem.

Thanks for your query, which got me off my duff on this one!

— Erik


n.p. Always glad to be of a help.
I have probably solved more issues just by asking some questions. When a person answers a question about an issue, they generally can’t skip over some of the details, some of their assumptions. And in doing so they solve their own issues. :wink:

Good luck!


Execute Macro passes in (at least potentially) a trigger value of its own, so probable a subtle change in how it works is that the trigger value is no longer implicitly passed down.

You can do:

Execute Macro with parameter %TriggerValue%

if you want to pass it on to the executed macro.

Anyway, I’m glad it is back working.

An excellent suggestion, @peternlewis — thank you!