Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question
add comment

3 Answers 3

up vote 6 down vote accepted

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

share|improve this answer
    
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
add comment

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" to start current screen saver
share|improve this answer
add comment

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

   tell application "Finder"
shut down
end tell
share|improve this answer
    
That does not call the screen saver it does something totally different –  Mark May 17 at 17:13
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.