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.
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.
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.
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.