Re: lock the screen from the keyboard, win a prize
Re: lock the screen from the keyboard, win a prize
- Subject: Re: lock the screen from the keyboard, win a prize
- From: Paul Skinner <email@hidden>
- Date: Sat, 23 Nov 2002 12:20:38 -0500
On Friday, November 22, 2002, at 05:31 PM, John Delacour wrote:
At 1:34 pm +0000 22/11/02, Nigel Smith wrote:
Bring on the improvements!
set dir to "/Library/Preferences/ByHost/" -- sic
set ss to "/System/Library/Frameworks/ScreenSaver.framework/"
set ss to ss & "Versions/A/Resources/ScreenSaverEngine.app"
set f to dir & (do shell script "cd ~" & dir & ";ls | grep eensav")
do shell script "perl -e'$f = qq~$ENV{HOME}" & f & "~; open F, $f; $_
= <F>;
s~ger>0</int~ger>1</int~ ; open F, qq~>$f~; print F' ; open " & ss
delay 5
do shell script "perl -e '$f = qq~$ENV{HOME}" & f & "~; open F, $f;
$_ = <F> ; s~ger>1</int~ger>0</int~ ; open F, qq~>$f~; print F'"
JD
Hmmm... I ran it a few times but it didn't lock my screen. Although t
did change the name of my pref file to...
'com.apple.screensaver..Mac.[mymacaddress].plist
com.apple.screensaver. [mymacaddress].plist
com.apple.screensaver.slideshow. [mymacaddress].plist
com.scotlandsoftware.genericscreensaver. [mymacaddress].plist' *
*edited for content.
I actually prefer AppleScript. Verbose to the point of lucidity.
set previousState to SsaverPwordState({})
SsaverPwordState(1)
tell application "ScreenSaverEngine" to run
delay 5
SsaverPwordState(previousState)
on SsaverPwordState(parameter)
set {previousDelimiter, AppleScript's text item delimiters} to
{AppleScript's text item delimiters, ""}
set macAddress to (words 2 thru -1 of (do shell script "ifconfig en0 |
grep ether")) as string
set preferenceFile to "" & POSIX path of (path to preferences as
string) & "ByHost/com.apple.screensaver." & macAddress
if parameter is not {} then
do shell script "defaults write " & preferenceFile & " askForPassword
" & parameter
end if
set PwordState to "defaults read " & preferenceFile & " askForPassword
"
set AppleScript's text item delimiters to previousDelimiter
return (do shell script PwordState) as integer
end SsaverPwordState
--
Paul Skinner
Based on code posted by Nigel Smith & Philip Aker
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.