Starting Screen Saver Is Not Working on macOS Catalina

It is a simple macro, starting a screen saver. (I used the macro library of KM).
And then I tested it through apple script in order to pinpoint where the error is coming from.

But only this works if I did the same through apple script as the following:

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

However, the following apple script does not work for me.

tell application "System Events" to start current screen saver

The current screen saver is "Shifting Tiles"
And then

tell application "System Events" to start screen saver "Shifting Tiles"
produces an error of "there is no such name"

This does not appear to be a Keyboard Maestro bug, as I confirmed the exact same thing in Script Editor:

This works:

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

This does nothing and gives no error message:

tell application "System Events" to start current screen saver

This generates an error:

tell application "System Events" to start screen saver "Shifting Tiles"

System Events got an error: Can’t get screen saver "Shifting Tiles".

With a Script Editor console error of:

error "System Events got an error: Can’t get screen saver "Shifting Tiles"." number -1728 from screen saver "Shifting Tiles"

Not sure where to go from here with this information…

This is a system bug. It is not new to Catalina, it has been around since at least Mojave I believe.

It has long ago been reported to Apple, and no doubt they are all hard at work fixing the bug… or something.

You should, of course, use the Feedback app in Catalina to report the AppleScript bug (don't mention Keyboard Maestro, that will make them less likely to fix it than if it is just a straight system bug).

2 Likes

@peternlewis and @shrewdacumen, FWIW, I use LaunchBar to start the screen saver in Mojave and it works perfectly every time.

A workaround that worked for me (Big Sur):

  1. In System Preferences, set a corner to start the screen saver.
  2. KM macro moving the mouse to that corner.

This still exists in Big Sur on the M1 Chip - it seems that running the applescript of

tell application "System Events" to get the name of every screen saver

Reports that Applescript only 'sees' like 10 of them.

{"Random", "Word of the Day", "Arabesque", "Hello", "Flurry", "Drift", "Shell", "Album Artwork", "FloatingMessage"}

Seems they haven't updated the Applescript dictionary/library for the Screen Saver.
So, using:

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

will work, because it's in the dictionary.

Using

do shell script "/System/Library/CoreServices/ScreenSaverEngine.app/Contents/MacOS/ScreenSaverEngine" 

will launch the default screen saver you have selected in preferences.

2 Likes

Thank you for this!