Wolfs Recent Howls

Wolfs Categories

Wolfs Past Howls


« Paying lip-service | Main | Problem solved »

Calling AppleScript gurus everywhere

By Wolfie | June 3, 2008

I’m using the BBC iPlayer to watch a lot of TV at the moment. The problem is that, to get uninterrupted viewing, I have to keep changing my screen saver and display sleep settings (or sit really near the screen so I can keep moving the mouse to keep everything awake).

I found an Apple Script that I’ve edited (very slightly) to allow me to set the screen saver idle time from a simple dialogue box, but I’d like to be able to extend it to also set the display sleep settings as well. Anyone got any ideas how (if) I can do this?

The script I have so far is:

set screenSaverTime to the text returned of (display dialog “Enter screensaver time delay (in seconds)” default answer “300″)

set displaySleepTime to the text returned of (display dialog “Enter display sleep time delay (in seconds)” default answer “900″)

set prefsFolder to (path to “pref”)’s POSIX path & “ByHost/”

tell application “System Events”

set prefsFile to property list file ((folder prefsFolder’s first file where name starts with “com.apple.screensaver.”)’s POSIX path)

tell prefsFile

set value of property list item “idleTIme” to screenSaverTime

end tell

if exists process “System Preferences” then quit application “System Preferences”e

end tell

The idea being that, when I’ve finished watching the program, I can run the script again and the default values will reset the screen saver and display sleep to more normal settings without me having to go back through the System Preferences.

Categories: Technology |
Tags: , ,

Subscribe by: Email or RSS :: Copyright 2008. All rights reserved. No reproduction without prior permission. :: Disclaimer: All opinions in this blog are either my own or completely made up; you decide.

RSS feed | Trackback URI

1 Comment »

[...] time I have no idea where to start (at least with the last one, I had some guidance [...]

2:26 pm :: July 17th, 2008
 
Name (required)
E-mail (required - never shown publicly)
Website
Your Comment | Make the text box smaller or larger