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?

15

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

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

tell application "ScreenSaverEngine" to run

We're looking for long answers that provide some explanation and context. Don't just give a one-line answer; explain why your answer is right, ideally with citations. Answers that don't include explanations may be removed.

  • 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 Jul 4 '18 at 12:47
-2

To shut down your computer you can try to type in this code:

   tell application "Finder"
shut down
end tell
  • 3
    That does not call the screen saver it does something totally different – user151019 May 17 '14 at 17:13

You must log in to answer this question.

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