Start screensaver action doesn't work

I'm trying to create a macro triggered from a hotkey to hide all windows and then start my screensaver (that way when the Mac unlocks, all the windows are hidden and I'll be able to see the nice new Sonoma screensaver transition to desktop). However, the 'Start Screensaver' action doesn't do anything. I checked if there are any filters on my macro group and that's not the issue.

When I test the macro, the windows hide but the screensaver doesn't start.

I'm stuck... Thanks in advance for any help

1 Like

Yeah, this has been a longstanding bug in macOS unfortunately.

The action is the vey trivial AppleScript:

delay 1
tell application "System Events" to start current screen saver

Since about five or six macOS versions ago (sometime last decade), the current screen saver has a tendency of returning

screen saver ""

which unsurprisingly doesn't work.

If you fiddle around with your screen saver settings (change it a few times) it might start working.

Or you can write your own AppleScript like the above but specifying a screen saver explicitly using the Execute an AppleScript action.

Here is a list of ones on my Mac, they may be different on other Macs:

  • screen saver "Random"
  • screen saver "Word of the Day"
  • screen saver "Arabesque"
  • screen saver "Hello"
  • screen saver "Flurry"
  • screen saver "Monterey"
  • screen saver "Drift"
  • screen saver "Shell"
  • screen saver "Album Artwork"
  • screen saver "FloatingMessage"
1 Like

Thanks for the response @peternlewis. Do you know what I would use to run a random screensaver from the new ariel screensavers in MacOS Sonoma?

Not off hand, no. You could look at the AppleScript dictionary for System Events, or try the command:

tell application "System Events" to  screen savers

to get a list of them.

If you had a list and wanted to start one of them at random, Keyboard Maestro could do that.

Thanks, I'll give this a go.

1 Like

Hey @paulminors

Did you make any headway with this? I can't get any screen saver to work since Sonoma dropped.

Thanks

I can trigger the screensaver using AppleScript:

tell application "System Events" to start screen saver "Drift"

But wasn't able to adapt the script to work with the new Sanoma screensaver.

Thanks @paulminors. Sadly this does not work for me.

tell application "System Events" to name of screen savers

returns just Random, FloatingMessage. The other screen savers seem to have disappeared since Sonoma dropped, and the AppleScript silently fails when trying to start these two anyway.

Will keep digging.

Looks like it's been raised with Apple a couple of hours ago: How to programmatically set screen… | Apple Developer Forums

1 Like

Thanks for asking the question. I need to remember to search the forum sooner when seemingly simple stuff doesn't work. "run the screen saver" was my attempt to try and make a macro just to test things after not making a macro for a very long time and I was starting to get frustrated.

1 Like

Thanks to the Apple Dev Forums link from @sievins, I found this analysis, which led me to a solution which is good enough for me, if you're okay with your wallpaper going black for about 1 second when you switch screensavers/wallpaper.

Here's a gist with my solution, written by ChatGPT. See my comments at the end for usage instructions.

1 Like

Thanks @orand. This solution also works for me: How to programmatically set screen… | Apple Developer Forums.

Link seems to be dead. Tried to access this information since I just updated to Sonoma and noticed that my "screen locking" macro no longer works.

I did notice that there is a built-in "Lock Screen" keystroke in Sonoma so, I may use that instead.

To see the Apple link, you need to be an Apple registered developer. However, both the (non Apple) links posted by @orand work as expected here.

-rob.

1 Like

Open this instead: /System/Library/CoreServices/ScreenSaverEngine.app

This did the trick, thank you! :pray:

1 Like