« Calling AppleScript gurus everywhere | Main | On the buses »
Problem solved
By Wolfie | June 4, 2008
After my plea for help yesterday, I’m happy to say that the problem has now been solved - thanks to Niel and xnav over at the AppleScript forum on the Apple website. They gave me the help I’d needed to complete my editing of the script that I originally found thanks to lundy over at the Apple Insider forums. My contribution to the script has really been just to add a couple of dialogue boxes.
Anyway, for anyone out there that was having the same frustration that I was when using the BBC iPlayer, this script will enable you to quickly set and re-set your display sleep time and your screensaver idle time. Set them to a long time when you’re watching a programme, and then set them back to default when you’ve finished.
set TimeDelay to the text returned of (display dialog “Enter screensaver time delay (in minutes)” default answer “5″) —- Change the value of 5 if your default setting is not five minutes
set displaySleepTime to the text returned of (display dialog “Enter display sleep time delay (in minutes)” default answer “15″) —- Change the value of 15 if your default setting is not 15 minutes
do shell script (”pmset -a displaysleep ” & displaySleepTime) password “xxx” with administrator privileges —- Either change xxx to your password, or remove ‘password “xxx”‘ altogether, so that the system prompts you for your password each time
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 (TimeDelay * 60)
end tell
if exists process “System Preferences” then quit application “System Preferences”
end tell
Categories: Technology |
Tags: AppleScript
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.

No comments yet.