How Do You Run a Macro When the Screensaver is On?

I have a macro I want to run in the morning before I get up. It closes down certain apps and opens others. Basically, it sets up my perfect work environment.

In the past, this macro wouldn't run if the screensaver was on. As a result, I found this AppleScript that woke my computer up, entered my password, and then ran the macro. However, this is no longer working on macOS Mojave.

Does anyone know of a workaround?

I have my computer wake automatically shortly before I have my “open apps” macro run with the energy savings preferences. Within KM there are actions to “stop” screensaver and "wake" screen in the systems commands folder. Those two options should make it to where your macro runs flawlessly.

23

That seemed to work. Here's what the new macro looks like.

Glad to hear you got it working! 4:00 am huh? Ouch.... :stuck_out_tongue_winking_eye:

Hi @michaelhyatt, in your screenshot you can see that you save your Mac password in KM in plain text. This is not such a good idea. I use a macro that retrieves the password from the keychain and then inserts it. Alternatively I can do this with 1Password.

If the password is used, I have it confirmed to me via Pushover on my iOS devices and the Apple Watch (can also send SMS or Mail via KM), so if I'm not on the Mac and someone unauthorized logs in, I'll quickly go to :wink:
You can find the article to retrieve your password here:

My macro runs when I wake up my Mac with the mouse or by pressing a keyboard key:

wake.kmmacros (3,8 KB)

wake

I also use the free Amphetamine App and switch it on automatically as soon as my Mac wakes up, so you don't need a script for it, just a corresponding setting in the menu of the App

2018-11-21_17-22-19

2 Likes

I have in the case that you store passwords in the KM macros you should be on the safe side @michaelhyatt.

I'm already using "Safer KM Macros" against curious glances and clumsy children's hands :wink:

The app is called iLock

2018_11_22%20KM_Forum%20

That is fascinating. However, I can't get it to work. Here’s what I did.

  1. I created a password in Keychain called Wake_KM.
  2. I start my screensaver.
  3. I attempt to wake the computer by pressing a key or moving the mouse.
  4. The computer awakes and prompts me to enter my password.
  5. Nothing happens. The macro does not pass any text to the password field.

I inserted a Display Text action right after the macro grabs the password from Keychain just to verify that it is successfully accessing the password and storing it in the variable. It is.

What am I doing wrong?

Also, I am not sure why I need Amphetamine.

Thanks.

I had to insert a Return keystroke to get my Mac to display the password field (see red arrow below). Also, the first time you run this, Keychain asks for your system password to access the Wake_KM password. I chose “Always Allow.” Finally, I run this as a subroutine in a larger macro that sets up my work environment before I get up.

2 Likes

Hello @michaelhyatt, please excuse my mistake in yesterday's post (Macro). I have now added the trigger "At Login" to my macro.

The Amphetamine App is not required for execution. I only mentioned it because I saw Caffeinate in your AppleScript.

Using the Time Trigger (4:00 AM) for the macro is a good idea. Just when you want the Mac to wake up at a certain time.

I myself use the macro without the Wake / Login / Time trigger, I've set up a touch gesture to trigger in with BetterTouch Tool. Of course you can also use a shortcut.
Especially with the upgrade to macOS Mojave it was a huge time saving when confirming the required permissions.

Thanks!

1 Like

For me it works without additional Return. I will give it a try, thanks for the feedback :+1:

That's what I was doing, too.

Another tip for safety:
I put the macro into a macro group and then set up this macro to switch on and off. If I leave the Mac inadvertently, nobody can accidentally unlock the Mac... you never know.

09)Home

1 Like

Hi @michaelhyatt , I was working on this concept awhile back and gave up.
So before I spend time testing I thought I would ask:
If the computer is asleep and there is a password required when it wakes up...
Is it possible to set this macro to run at a time ie 4am ( I know that's possible) and:
wake up the computer and
enter the computer password (stored in the keychain)?
I currently use the keychain for another procedure to get a password, fyi.
I appreciate your help.

I stopped using this macro. I just tried it on Monterey and it doesn't seem to work.

1 Like

I'd really like to be able to do this,,,, seems out of reach,
cheers

I would be cautious posting blurred images of your password. There is software that can de-blur things like that, for example:

1 Like