September 24, 2017, 7:34pm
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:
Hi everyone. I'm trying to setup Keyboard Maestro with Hazel to turn my mac into a "robot" that runs KM macros using info from .rtf files.. I've asked in the Hazel forum but haven't found a solution yet. Does anybody have any ideas how to get this working?
I'm trying to create a mac "robot" that runs macros when instructions are sent to it via email. The instructions are sent as .rtf file attachments. I want to create a drip-feed system for processing .rtf files that are emailed to my mac. I'v…
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"
September 25, 2017, 11:21am
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.
September 25, 2017, 11:58am
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.
September 25, 2017, 10:03pm
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.
September 25, 2017, 10:24pm
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!
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.
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.
September 26, 2017, 9:22am
An excellent suggestion,
@peternlewis — thank you!