Hello, everyone —
I’m at my wits’ end here trying to figure out why there is a 17-second delay after a rule match before a script runs.
Scenario:
A file matches a set of rules, and processing of actions begins. This is typically about 1 or 2 seconds after the file has appeared in a watched folder, or changes its name. This delay is perfectly acceptable and expectable, of course.
My first action sets a color label so that I can tell at a glance that the file has been matched and that actions are being processed. Despite this being Finder, it seems to occur almost instantly.
The second action calls a brief script that does nothing other than calling a Keyboard Maestro macro. KM is flexible in how it is called, and I have tried both AppleScript and KM’s new keyboardmaestroCLI (shell) command — I would guess that both are actually just invoking AppleEvents if I looked behind the curtain. In both cases, I can always count to (exactly) 17 before KM begins its first step.
The macro runs fine and does what I expect, and Hazel then runs the final action on the file: removing the color label. It does this instantaneously.
My first thought was that this was a Keyboard Maestro, or more likely an AppleEvent problem. Easily tested: I invoked the same CLI command from Terminal. The macro began instantaneously. So the problem would seem to be with Hazel.
Just to be sure, I created a new KM script that had only one step, rather than my initial complicated one. 17-second delay if invoked from Hazel.
I’m running macOS 14.3 on an M1 MacBook Pro Max with 64GB RAM; not the fastest laptop on the planet, but 24 months ago it was, so that really shouldn’t be an issue.
Current versions of both Keyboard Maestro and Hazel.
Nothing helpful in the logs (about 19 seconds of no entries, with all logging turned on). The only thing I can think might be relevant is that I always see macOS’s little blue “Locations” indicator light pop up in my menubar at about the 3-second mark.
Any ideas? I can live with this, but it doesn’t seem to be working quite as designed....