9

I had a script that I used to use to activate my screen saver, and it no longer works in Mountain Lion.

It was a shell script that called an AppleScript script:

#!/bin/bash
osascript /Users/lorin/scripts/lockscreen.scpt

This is what the lockscreen.scpt file looks like:

tell application "ScreenSaverEngine" 
        activate 
end tell

If I bring up lockscreen.scpt in the AppleScript Editor, I get the "Choose Application" dialog popping up asking "Where is ScreenSaverEngine?"

Anybody know the Mountain Lion-y way to activate the screen saver?

3 Answers 3

16

That is a nice way of starting a random screen saver. If, however, you'd simply like to start the active screen saver, you can use this in Mountain Lion:

tell application "System Events" 
    start current screen saver
end tell
7

This works in ML:

tell application "System Events"
    set ss to screen saver "Random"
    start ss
end tell

"Random" can be replaced with your choice, "Flurry" or "Shell" and so on.

Source Disclosure: http://hintsforums.macworld.com/showthread.php?t=111478

2
  • How do I make it stop the screen saver? I tried tell application "System Events" to stop screen saver
    – Jayen
    Commented Aug 22, 2012 at 0:55
  • @Jayen tell application "System Events" to quit current screen saver
    – wrtsprt
    Commented Aug 22, 2013 at 9:32
3

tell application "ScreenSaverEngine" to run

1
  • I had issues with tell application "System Events" to start current screen saver. if i ran that script multiple times using a keybinding i would have multiple screensavers stacked, only the first would close. This answer however, worked perfectly for me.
    – Tom Kay
    Commented Jul 4, 2018 at 12:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .