How Can I Improve My System Wake Trigger?

Hey all,

I'm using System Wake as a trigger to run a macro which need access to app-specific menus items.

The trigger works great, however it seems that my Pause Until (menu condition) rules aren't being obeyed.

When I wake my Mac (prior to inputting password) the macro runs but I would like to wait until I've submitted my password. Based on my testing, submitting password on wake is not equal to the At Login trigger(?).

I tried pause until menu item exists: "About This Mac" but KM doesn't seem to have access to the system toolbar menu? I've also tried pausing until the menu item I want to interact with exists, but that doesn't seem to find it if the macro begins running before I've typed my password.

As-is I'm using a Pause Until Found Image, then watching for the Mac toolbar Apple icon. That's contained inside an iterative loop to account for taking a long time in between wake and password submit. In essence, it starts running, checks for Apple icon then waits 2 seconds before checking agin for the icon, with a max of 30 seconds of total looping. Once it's found, it proceeds outside the loop.

This works but I'm hoping there's a more concrete way of checking that my Mac is awake AND new session logged-in. Can AppleScript detect this state perhaps?

Thanks in advance for your thoughts!

Are you using "pause until" with SCREENSAVER to make sure that the screen is unlocked before the macro tries to run?

https://wiki.keyboardmaestro.com/function/SCREENSAVER?s[]=screensaver

I have a similar problem (and solved it with the macro included) - though I don't need my task to run immediately on logon, just when the computer is logged in and idle (so that I don't interrupt the macro actions by moving the mouse pointer etc!).

1 Like

Solved: Thanks to @peternlewis this is trivial with the trigger: When the Mac is unlocked trigger introduced in v10 November, 2021.