Re: Scripting Energy Saver to Sleep Display Now?
Re: Scripting Energy Saver to Sleep Display Now?
- Subject: Re: Scripting Energy Saver to Sleep Display Now?
- From: kai <email@hidden>
- Date: Mon, 14 Mar 2005 20:26:33 +0000
On Monday Mar 14, 2005 2:32:21 am Europe/London, Marconi wrote:
At 2:45 PM -0700 3/13/05, Gnarlodious issued a series of ones and
zeros which decoded as:
Entity Marconi spoke thus:
Does anyone know what parameter can be changed via script to cause
the Energy Saver to sleep the display(s) immediately, rather than
have to wait until the "Put display to sleep when the computer has
been inactive for:" period of time?
That is, if the above setting is 1 hour, can one, via a script, make
the system think that an hour of inactivity has occurred? Surely
there's a flag somewhere which indicates that the set period has
elapsed and the display should power down right now, yes?
Possibly look at
man pmset
For example, you can set disk spindown time like this:
sudo pmset -c spindown 5
I'll look at it but remember, I don't want to change the settings, I
just want to change the flag that tells the system that the setting
has been reached.
I'm not sure that there's an easily accessible way to modify the 'due
flag' (or whatever it might be called).
However, Rachel's suggestion (which *would* involve changing settings)
might still be adapted in some way - to at least dim the display. For
example, you might consider changing the settings, and then restoring
them once the screen has dimmed.
The only real problem with this is that the minimum idle setting is 1
minute. (A zero value evidently means "never".) Nevertheless, if you're
prepared to accept that compromise, you could try something along the
lines of the script below.
Since the lines are quite lengthy, I've double-spaced them - to help
identify any unwanted wraps that might occur. There are just 3 lines,
including the script property, 'p'. At compile time, 2 things should
happen: first, you'll be asked for your password - and then the final
line should wrap into 2 (don't rejoin these - leave them as compiled):
------------
property p : text returned of (display dialog "Please enter your
password:" default answer "")
set v to word -1 of (do shell script "echo " & p & " | sudo -S pmset -a
-g | grep dim")
do shell script "echo " & p & " | sudo -S pmset -a dim 1\nsleep 60;
echo " & p & " | sudo -S pmset -a dim " & v
------------
(When running the script, you'll obviously have to wait a minute before
anything happens.)
It's not that clear to me exactly what you're trying to achieve with
all this. For most purposes, I'd personally be just as happy settling
for the screen saver...
------------
tell application "ScreenSaverEngine" to activate
------------
---
kai
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden