You are here: Home → Forum Home → The Mac Observer Forums → Design & Create → Thread
AppleScript to disable screen saver
-
New2Mac 2007
- [ Ignore ]
I am new to AppleScript and would like to write a script that will disable my Energy and screensaver so that I can watch movies from the internet on my Mac without the screen saver coming on and without the display or computer going to sleep.
To start with I would like to disable the screensaver. I have no clue as to how to do this but I came across this code on the net
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 “moduleName” to “Computer Name”
set value of property list item “idleTIme” to 10
set value of property list item “modulePath” to “/System/Library/Frameworks/ScreenSaver.framework/Versions/A/Resources/Computer Name.saver”
end tell
if exists process “System Preferences” then quit application “System Preferences”
end tellI removed two of the set value properties list time lines so the code reads
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 10
end tell
if exists process “System Preferences” then quit application “System Preferences”
end tellWhen I try to run the code I get
AppleScript Error
System Events got an error Can?t set property list item “idleTIme” of property list file “MacintoshUsersstevewetzelLibraryPreferencesByHostcom.apple.screensaver..Mac.001b6393d9e7.plist” to 10.What am I doing wrong? More importantly, how and where would I ever find that documentation to assist me in learning that I need to use prefsFolder (whatever that is), to do this?
Can anyone offer some assistance??
Signature
Wow this is so much better then my old Mac Plus!
Steve

