ScriptSaver: screensaver-triggered AppleScript

ScriptSaver is a Mac OS X screensaver which runs AppleScripts when it activates and deactivates. A common use for this is to perform periodic maintenance tasks, run cleanup scripts on kiosk machines, or simply update iChat status when the computer is idle.

Update: now supports 64-bit Snow Leopard systems!

ScriptSaver configuration panel
The ScriptSaver configuration panel

To install ScriptSaver, copy ScriptSaver.saver to the Screen Savers folder in the Library folder of your home directory. Source code is included.

Download ScriptSaver.

If you’re interested in seeing what can be done with ScriptSaver, example scripts are available to do things like log out the current user, play/pause iTunes, set an iChat away message, and more. You can download these here.

31 Comments

  1. Monty Sher
    Posted January 2, 2009 at 11:40 am | Permalink | Reply

    Thanks for this useful tool. I have set it to run a script which activates Front Row to display photos from the iPhoto library. Sometimes the display freezes when starting with a particular set of photos. Do you have any idea why? Another question: is there a set period of time at which ScriptSaver deactivates?

  2. Posted January 2, 2009 at 11:46 am | Permalink | Reply

    Hi Monty — I’m not familiar with the Front Row problem you describe. Does rebuilding the iPhoto library resolve the issue? Here’s how to do so:

    http://support.apple.com/kb/HT2638

    ScriptSaver’s deactivation event is called when the operating system decides to cancel the screen saver (generally because of keyboard input or a mouse movement)… it won’t deactivate itself.

    You might be able to deactivate the screensaver by letting your activation script quit the ScreenSaverEngine process after a given amount of time has elapsed, however.

  3. Adam Bell
    Posted January 4, 2009 at 11:59 am | Permalink | Reply

    Great stuff. I had been using the Scenario Preference Pane which is no longer published and wasn’t entirely satisfied because it triggered on Sleep. This is exactly what I want — triggers a script that uses a Sophisticated Circuits PowerKey Pro 650 to turn a bunch of stuff on and off when the screen saver comes on or goes off.

    http://www.sophisticated.com/products/powerkey/pkp_650.html

  4. Matthew
    Posted January 6, 2009 at 1:19 pm | Permalink | Reply

    I’m noticing that the screen saver is periodically deactivating without keyboard or mouse movement. What other types of events can cause the OS to deactivate the screen saver? Is there a way to increase logging to record the event that caused it?

    TIA

  5. Doug Korns
    Posted January 11, 2009 at 1:17 am | Permalink | Reply

    The Configure ScriptSaver screen shot above the comments on the web page shows version 2.8 (in a window, not a drop-down sheet), while the Download ScriptSaver link on the same page only gets you ScriptSaver version 2.1!

    I noticed that a screensaver, such as ElectricSheep, that normally runs on multiple displays, only shows on the main display after being passed control from ScriptSaver. Is that a bug to be fixed? Or fixed in v2.8 perhaps?

  6. Posted January 11, 2009 at 9:01 am | Permalink | Reply

    Doug, thanks for trying ScriptSaver! The download link points to version 2.10 — there have been two versions since 2.8, but none big enough to warrant a jump to 3.0.

    I haven’t looked at supporting multiple displays yet… I believe it’s possible, just not yet implemented. ScriptSaver isn’t under active development, but I’ve made a note to look at that next time I make changes in the codebase.

  7. Clayton
    Posted April 8, 2009 at 10:31 am | Permalink | Reply

    This sounds very useful.

    Do you know if the reverse is possible?

    I’m trying to write an Automator app that wakes a remote machine from screensaver, loads a webpage and takes a screencap.

    I can’t figure out the part of deactivating the screensaver by Automator.

    Any suggestions? Thanks!

    • Stephen Howell
      Posted June 25, 2009 at 6:40 pm | Permalink | Reply

      @Clayton

      Run an applescript within the automator action that sends a key command to stop the screensaver like any other keystroke would.

      Example:
      tell application “System Events” to keystroke tab using command down

      or

      tell application “System Events” to keystroke “n” using {command down, shift down} — get all new mail in Mail.app

  8. Posted August 30, 2009 at 12:17 pm | Permalink | Reply

    Just upgraded to Snow Leopard, and ScriptSaver doesn’t work. Any possibilities that it will be upgraded to work with 10.6?

  9. Posted August 30, 2009 at 9:14 pm | Permalink | Reply

    Definitely — I’ll try to recompile it for 10.6 this week.

  10. Brian
    Posted September 1, 2009 at 12:44 pm | Permalink | Reply

    Can’t wait for the Snow Leopard-compatible Scriptsaver!

  11. Posted September 2, 2009 at 11:52 pm | Permalink | Reply

    I’ve updated ScriptSaver to include a version that’s compiled for 64-bit Snow Leopard systems. Try it out and let me know if it works for you!

  12. Posted September 3, 2009 at 1:09 pm | Permalink | Reply

    Just tried 2.11 on my snow leopard system, and once installed in Library/Screen Savers, it comes up saying “cannot be used on your system”. Am I doing something wrong? I’ve tried 32 and 64 bits versions…

  13. Posted September 3, 2009 at 11:11 pm | Permalink | Reply

    Hmm — my beta testers verified that ScriptSaver 2.11 works on 64-bit systems running Snow Leopard, in both 32- and 64-bit kernel mode. James, I’ll email you and see if we can’t figure out what’s going on here…

  14. Posted September 13, 2009 at 2:10 pm | Permalink | Reply

    Matt, I ran into the same problem that James is seeing above. I’m running 10.6.1 in 32-bit. Let me know if there’s anything I can do to help.

  15. Posted September 13, 2009 at 6:46 pm | Permalink | Reply

    Hi Jehan — I’m running 10.6.1 in 32-bit as well and am able to use the ScriptSaver.saver in the latest .zip file available above… could you try deleting ScriptSaver.saver from your Screen Savers directory and re-installing?

  16. Manfred
    Posted September 16, 2009 at 1:13 pm | Permalink | Reply

    Hi,
    As my iMac will never sleep I found your great piece of software. THANK YOU

    I now wrote an AppleScript which tells the Mac to sleep after 15 minutes. If I start my script with “delay 900″ I see 15 minutes of black screen. When I do it in “asynchronous” mode” I see the preset screen saver but as the script already started I am N O T able to stop the script anymore and it sleeps my Mac after 15 minutes!?
    When I set it to “NOT asynchronous mode” I can CANCEL the script using the ESC-key.

    Any idea how to interrupt a running script in “asynchronous mode”???

    Thanks for your help
    Manfred

  17. Posted September 17, 2009 at 7:04 pm | Permalink | Reply

    @Manfred, that’s an interesting one… in “asynchronous mode” we fire off your AppleScript but then immediately start the screensaver without waiting for your script to finish.

    I don’t know of an easy way to intercept keypresses while the screensaver is running… but what if you wrote a deactivation script that killed all currently-running Applescripts (using the command-line tool ‘kill’)?

  18. Josh
    Posted September 18, 2009 at 12:39 am | Permalink | Reply

    Hi Matt,

    this is a great app.
    I just came here by googling around for a problem I am trying to solve in one of my own apps.

    Eventually you are the right man to comment here:
    http://stackoverflow.com/questions/1443243/launchagent-is-there-something-like-runatscreensaver

    :-)

    Cheers & keep up the good work,

    Josh

  19. Manfred
    Posted September 18, 2009 at 1:21 am | Permalink | Reply

    Hi Matt,

    you were right!!!

    do shell script “killall ” & quoted form of (“osascript”)

    did the job … I don’t know if this is a real perfect solution but it works so far :)

    thanks for your help
    Manfred

  20. Posted September 18, 2009 at 4:10 am | Permalink | Reply

    Matt, sorry it took a few days; I deleted ScriptSaver from my screensavers folder and re-installed it. Still no luck, though. It’s greyed out in the Screen Savers pref pane, and when I select it, I still get the same error.

  21. Posted September 23, 2009 at 7:45 am | Permalink | Reply

    Update: I worked with Jehan to track down the issue here. ScriptSaver 2.12 is now more compatible with certain systems and is available from the download link above.

  22. SRob
    Posted September 24, 2009 at 8:09 am | Permalink | Reply

    ScriptSaver 2.12 reports the following error when selected in the pref panel:

    Can’t load screen saver
    Screen saver “ScriptSaver” did not load properly. Please select another screen saver.
    Error: Can’t load bundle

    I’m running OS 10.5.8, everything up to date. I’ve downgraded to a copy of 2.11 from my archives, which is still working perfect.

  23. Posted September 24, 2009 at 8:23 am | Permalink | Reply

    Okay.. I’ve updated ScriptSaver.zip to include the “old” binary from 2.11. Could you verify that it works on your machine?

    (I tested 2.12 on a 10.5 system, so I’m not sure why it’s not working.)

  24. SRob
    Posted September 24, 2009 at 8:37 am | Permalink | Reply

    Just downloaded your update and installed the “old” binary… works perfectly.

  25. Chris G.
    Posted September 26, 2009 at 7:55 pm | Permalink | Reply

    Hi Matt,

    I love your program!! Great work!!!

    I’m having an issue when selecting the RSS Visualizer as the screensaver to run after launching the script. It is displaying the default “Apple Hot News” feed rather than the feed I have selected in the RSS Visualizer settings (in other words, running RSS Visualizer outside of ScriptSaver displays the feed I want, but running RSS Visualizer through ScriptSaver displays the “Apple Hot News feed”).

    Any suggestions?

  26. Posted September 28, 2009 at 10:12 pm | Permalink | Reply

    Great question Chris. By default, there’s no “easy” way for ScriptSaver to load all the info about the RSS Visualizer or other Quartz Composer screen savers… they aren’t traditional screensavers in the sense that they have code and a preferences file and all that. Right now I detect that it’s a .qtz file and do some special things to make it display on the screen.

    I’m not real sure how the screensaver pref pane passes in preferences for the RSS Visualizer. If you have Apple’s free developer tools installed, you can duplicate the RSS Visualizer file (/system/library/screen savers) and change the default RSS feed URL to the one you want… if you want to go that route, let me know and I can give you step-by-step directions.

  27. J0hnd0e
    Posted October 31, 2009 at 4:25 am | Permalink | Reply

    it seem’s that the download version is 2.10…

  28. Henry Streiffer
    Posted November 6, 2009 at 11:52 pm | Permalink | Reply

    I would like my screensaver to alternate between 2 screensavers – a folder of photos & Marine Aquarium. Is there a way to do this.

    Cheers & Thanks
    Henry

  29. Travis
    Posted November 15, 2009 at 4:16 pm | Permalink | Reply

    I am trying to use scriptsaver to launch an iTunes visualizer as the screensaver like this article suggests here http://www.macosxhints.com/article.php?story=20040205044431199 but the problem is scriptsaver also launches a screensaver over top of the visualizer. even if “none” is selected it’s just a black screen. anyway to just launch the script and othing else?

  30. Posted November 20, 2009 at 7:52 pm | Permalink | Reply

    Thanks for the great freeware product! I’ve used it in 2005 to install a screensaver for Gemini Observatory. It really just runs an applescript that launches a Director projector.

    Back then I was able to hack (and I do mean hack, I know nothing about C or Xcode, just poked around until it worked) a default location for what was then called the “location” key. Now it looks like you’ve called it something else.

    To make a long story short, I can’t seem to figure out how to hack this new version, and the old version doesn’t work anymore on Snow Leopard. Is there an easy way?

    FYI – the end result is part of a giveaway educational product, a CD-ROM called Gemini Observatory Virtual Tour. I get paid to upkeep it (work for hire). If you’d like payment for it, let me know & I see if we could swing it. In any case I’ll be happy to send you a copy.

    Thanks for considering this.

    ~Reed

9 Trackbacks

  1. By ScriptSaver 2.9 « scattershot genius; on November 30, 2007 at 10:24 pm

    [...] PDF to Gerber and NC Drill formatstxt2booklet: Generate directories with Perl and XHTMLScriptSaver: Run AppleScripts at screensaver activation timeQuotes « [...]

  2. By Mac Lab Rat - GGP #71: Horse Kennel | K's Weblog on December 8, 2007 at 12:29 pm

    [...] First up this week is a Screen Saver application called ScriptSaver by Matt Swann.  I call this a Screen Saver Application because though it’s launched by your [...]

  3. By ScriptSaver 2.10 « scattershot genius; on April 24, 2008 at 8:18 pm

    [...] PDF to Gerber and NC Drill formatstxt2booklet: Generate directories with Perl and XHTMLScriptSaver: Run AppleScripts at screensaver activation timeQuotes « Anatomy of a [...]

  4. By ScriptSaver 2.10 on April 25, 2008 at 12:02 pm

    [...] Website Download ScriptSaver These icons link to social bookmarking sites where readers can share and discover new web pages. [...]

  5. [...] ScriptSaver [...]

  6. By Picks from MBW 90: Flippin’ the Bird on May 21, 2008 at 1:15 pm

    [...] at http://swannman.wordpress.com/ for free from Andy [...]

  7. [...] PDF to Gerber and NC Drill formatstxt2booklet: Generate directories with Perl and XHTMLScriptSaver: Run AppleScripts at screensaver activation timeQuotesBand names « [...]

  8. [...] PDF to Gerber and NC Drill formatstxt2booklet: Generate directories with Perl and XHTMLScriptSaver: screensaver-triggered AppleScriptQuotesBand namesPortfolio « Tolstoy [...]

  9. By Mac OS X: Invoke a Command w/ ScreenSaver | Krypted on October 28, 2009 at 10:01 am

    [...] developer has also made some sample AppleScripts available for use with ScriptSaver. For my purpose I just [...]

Post a Comment

Your email is never shared. Required fields are marked *

*
*