Setup: Keyboard Maestro macro drives Apple's Image Capture app, gating on Keyboard Maestro's native Button condition (Pause Until Conditions Are Met β "A button named 'Scan' is enabled"), and a companion script polls the scanner's own eSCL/AirScan status endpoint directly to track real progress. This is an attempt to replace an old native Display Progress loop that polled file size, which couldn't reliably tell a between-page pause apart from the scan actually finishing.
The problem: When Image Capture opens with with the source set to flatbed (as opposed to ADF), it automatically runs an "Overview Scan" β a preview scan β before the Scan button becomes usable. Critically, this preview registers as a completely genuine scan job on the scanner's own status endpoint, structurally identical to a real scan (same job state transitions, same page-count field) β there is no field anywhere that distinguishes preview from real. So we can't tell them apart from the scan data itself.
What we've solved: Image Capture's Scan button is disabled until the Overview Scan preview finishes, then becomes enabled. So gating on "Scan button becomes enabled" (Keyboard Maestro's native Button condition, via Pause Until Conditions Are Met) correctly skips past the preview in the normal case β the button transitions disabled β enabled, and only then do we start trusting the scan-status endpoint.
What's still broken: If the source is set to AD on opening Image Capture β where the Scan button is enabled immediately, even with the feeder empty, since ADF has no preview step β and the user then switches the source to Flatbed, the Scan button is already enabled from the ADF selection. Our Pause Until gate passes instantly, and we walk straight into the Flatbed Overview Scan preview that's now running, misreading it as a real scan.
We've already ruled out a couple of routes: Keyboard Maestro's Button condition can only read current state (exists/enabled/disabled), not a press event, confirmed on the wiki; and there's no accessibility notification for a stateless push button being pressed either (checked Apple's own AXNotificationConstants.h β nothing analogous to kAXValueChangedNotification exists for a plain push button, only for controls with a persistent value).
Best idea so far, not fully tested, wanted to check here first: if the ADF/Flatbed source selector itself is a UI element with a queryable value, gate on that being stable/unchanged for some N seconds before trusting the Scan-button-enabled check at all β i.e., wait out any mode-switching before we start watching the button. Feels like (because it is) a timing-based band-aid rather than a real fix, and we haven't confirmed the selector is even inspectable yet.
Question Is there a more deterministic way to catch this specific transition β something structural rather than a settle timer? Appreciate any ideas.
Here is the entire macro:




