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: John Delacour <email@hidden>
- Date: Sat, 23 Nov 2002 22:45:45 +0000
- Mac-eudora-version: 5.3a9
At 12:20 pm -0500 23/11/02, Paul Skinner wrote:
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.
Oh dear!
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
Yes that's, pretty concise and it's good to pick up a couple more
useful shell things. I'd trim it to this, removing some unnecessary
details:
set previousState to SsaverPwordState({})
SsaverPwordState(1)
do shell script "open -a ScreenSaverEngine"
delay 5
SsaverPwordState(previousState)
on SsaverPwordState(fl)
set ether to do shell script "ifconfig en0 | grep ether"
set en0 to "" & words 2 thru -1 of ether
set prefs to POSIX path of (path to preferences)
set plist to prefs & "ByHost/com.apple.screensaver." & en0
if fl is not {} then
do shell script "defaults write " & plist & " askForPassword " & fl
end if
set PwordState to "defaults read " & plist & " askForPassword "
do shell script PwordState
end SsaverPwordState
On another topic altogether, Demon customers have just been told they
should set their MTU to 1458 instead of the standard 1500, in order
to get the best throughput with broadband, but the helpdesk has no
idea how people should do this. I see that it is possible to set
this with ifconfig:
prompt>>> sudo ifconfig en0 mtu 1458
Now can anyone tell me to have this set at login? Which file should
it be written to?
JD
_______________________________________________
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.