Discussion:
OS X screen saver - somewhat off topic
(too old to reply)
Sarah Reichelt
2004-04-27 05:20:52 UTC
Permalink
Hi All,

I have a program running under OS X that monitors some electronics. As
it operates 24/7, I let the screen saver come on and after some hours,
I even let the screen go to sleep. My problem is getting the screen to
activate itself when the electronics send a message that it needs to
display.

I have tried an AppleScript to turn off the screen saver: quit
application "ScreenSaverEngine"
This works fine if the screen saver was turned on manually by pushing
the mouse pointer into the corner, but if the screen saver has come on
after it's set time, when the script tries to turn it off, it goes off
for about a second, displays the underlying Rev window, then comes back
on again. I have tried moving the mouse pointer location in Revolution
but this doesn't fool the screen saver setting :-(

I realize that I probably won't be able to wake the screen from sleep,
but I am tantalizingly close to being able to turn off the screen
saver. Has anyone else managed to do this? If it can't be done, I guess
I can always write myself a fake screen saver in Revolution, but I
would rather let the system do all the work :-)

Cheers,
Sarah
***@genesearch.com.au
http://www.troz.net/Rev/
Dar Scott
2004-04-27 05:46:26 UTC
Permalink
Post by Sarah Reichelt
I realize that I probably won't be able to wake the screen from sleep,
but I am tantalizingly close to being able to turn off the screen
saver. Has anyone else managed to do this? If it can't be done, I
guess I can always write myself a fake screen saver in Revolution, but
I would rather let the system do all the work :-)
Here is a silly idea. My screen save will turn on or off if I leave
the pointer in some particular corner depending on some settings.
Maybe you can move the mouse to some corner of the screen.

Dar Scott
Sarah Reichelt
2004-04-27 05:51:08 UTC
Permalink
Post by Dar Scott
Post by Sarah Reichelt
I realize that I probably won't be able to wake the screen from
sleep, but I am tantalizingly close to being able to turn off the
screen saver. Has anyone else managed to do this? If it can't be
done, I guess I can always write myself a fake screen saver in
Revolution, but I would rather let the system do all the work :-)
Here is a silly idea. My screen save will turn on or off if I leave
the pointer in some particular corner depending on some settings.
Maybe you can move the mouse to some corner of the screen.
That was my first idea, but the screen saver doesn't seem to recognize
that as a mouse move.

Sarah
Andre Garzia
2004-04-27 05:53:36 UTC
Permalink
Post by Sarah Reichelt
I realize that I probably won't be able to wake the screen from sleep,
but I am tantalizingly close to being able to turn off the screen
saver. Has anyone else managed to do this? If it can't be done, I
guess I can always write myself a fake screen saver in Revolution, but
I would rather let the system do all the work :-)
okay, I am being radical, but can't you kill the process using shell
function?

you could fetch the process using:

ps -aux | grep "ScreenSaverEngine"

first word will be process ID (pid)

then to a:

kill --KILL <pid>

This is radical, but if the process is dead then screen saver cannot be
on display right!?

Cheers
Andre

PS: I think that kill bill movie is making me a violent coder...
--
Andre Alves Garzia  2004
Soap Dog Studios - BRAZIL
http://studio.soapdog.org
Sarah Reichelt
2004-04-27 06:41:02 UTC
Permalink
Post by Andre Garzia
Post by Sarah Reichelt
I realize that I probably won't be able to wake the screen from
sleep, but I am tantalizingly close to being able to turn off the
screen saver. Has anyone else managed to do this? If it can't be
done, I guess I can always write myself a fake screen saver in
Revolution, but I would rather let the system do all the work :-)
okay, I am being radical, but can't you kill the process using shell
function?
ps -aux | grep "ScreenSaverEngine"
first word will be process ID (pid)
kill --KILL <pid>
Like the AppleScript, it works fine so long as the screen saver time
limit hasn't been reached, now to test if it has.

For anyone who is interested, the script is slightly different to the
one Andre suggested:
get shell("ps -auxc | grep " & quote & "ScreenSaverE" & quote)
if it is empty then exit to top
put word 2 of it into pID
get shell ("kill " & pID)

Many thanks,
Sarah
David Vaughan
2004-04-27 07:01:05 UTC
Permalink
Post by Sarah Reichelt
Like the AppleScript, it works fine so long as the screen saver time
limit hasn't been reached, now to test if it has.
For anyone who is interested, the script is slightly different to the
get shell("ps -auxc | grep " & quote & "ScreenSaverE" & quote)
if it is empty then exit to top
put word 2 of it into pID
get shell ("kill " & pID)
Sarah

If it works, then Transcript now supports the kill command for OS X,
including nominating the signal type (including 9). You are sending sig
1 or 15 (I forget which) in the above.

regards
David
Post by Sarah Reichelt
Many thanks,
Sarah
Andre Garzia
2004-04-27 07:11:45 UTC
Permalink
if our strategies trying to KILL the process fail, can we go for
AppleEvents? Can't we send a "Hey Quit!" apple event direct to the app
without using AppleScript?

Cheers
Andre
--
Andre Alves Garzia  2004
Soap Dog Studios - BRAZIL
http://studio.soapdog.org
Sarah Reichelt
2004-04-27 07:21:33 UTC
Permalink
Sorry, it doesn't work if the screen saver has come on after it's time
setting. In fact it is exactly the same as the AppleScript. You can see
it happening as the screens saver goes off for about half a second,
then comes straight back on again :-( Most frustrating as it seems that
it is ALMOST working.

Thanks for all your help anyway,
Sarah
Post by David Vaughan
Post by Sarah Reichelt
Like the AppleScript, it works fine so long as the screen saver time
limit hasn't been reached, now to test if it has.
For anyone who is interested, the script is slightly different to the
get shell("ps -auxc | grep " & quote & "ScreenSaverE" & quote)
if it is empty then exit to top
put word 2 of it into pID
get shell ("kill " & pID)
Sarah
If it works, then Transcript now supports the kill command for OS X,
including nominating the signal type (including 9). You are sending
sig 1 or 15 (I forget which) in the above.
regards
David
Dar Scott
2004-04-27 07:46:49 UTC
Permalink
Post by Sarah Reichelt
I realize that I probably won't be able to wake the screen from sleep,
Fiddling with settings with pmset?

Dar Scott
Dar Scott
2004-04-27 08:10:58 UTC
Permalink
Post by Sarah Reichelt
I realize that I probably won't be able to wake the screen from sleep,
/usr/bin/pmset -a dim 0

maybe

Dar
Dar Scott
2004-04-27 08:37:38 UTC
Permalink
Post by Sarah Reichelt
I realize that I probably won't be able to wake the screen from sleep,
but I am tantalizingly close to being able to turn off the screen
saver.
tell application "ScreenSaverEngine" to quit

I guess you already tried this.

Dar
David Vaughan
2004-04-27 09:42:27 UTC
Permalink
Post by Sarah Reichelt
Sorry, it doesn't work if the screen saver has come on after it's time
setting. In fact it is exactly the same as the AppleScript. You can
see it happening as the screens saver goes off for about half a
second, then comes straight back on again :-( Most frustrating as it
seems that it is ALMOST working.
Thanks for all your help anyway,
Sarah

To be precise, did your tests include kill -9, the real killer?

regards
David
Post by Sarah Reichelt
Sarah
Wouter
2004-04-27 10:52:35 UTC
Permalink
Message: 6
Date: Tue, 27 Apr 2004 17:21:33 +1000
Subject: Re: OS X screen saver - somewhat off topic
Content-Type: text/plain; charset=US-ASCII; format=flowed
Sorry, it doesn't work if the screen saver has come on after it's time
setting. In fact it is exactly the same as the AppleScript. You can see
it happening as the screens saver goes off for about half a second,
then comes straight back on again :-( Most frustrating as it seems that
it is ALMOST working.
Thanks for all your help anyway,
Sarah
Post by David Vaughan
Post by Sarah Reichelt
Like the AppleScript, it works fine so long as the screen saver time
limit hasn't been reached, now to test if it has.
For anyone who is interested, the script is slightly different to the
get shell("ps -auxc | grep " & quote & "ScreenSaverE" & quote)
if it is empty then exit to top
put word 2 of it into pID
get shell ("kill " & pID)
Sarah
If it works, then Transcript now supports the kill command for OS X,
including nominating the signal type (including 9). You are sending
sig 1 or 15 (I forget which) in the above.
regards
David
This works over here:

on wakeUp
put "tell application " & quote & "Finder" & quote & cr \
& "quit application " &quote& "ScreenSaverEngine" & quote & cr &
"end tell" into a
do a as applescript
end wakeUp


HTW
Greetings,
WA
Thomas McGrath III
2004-04-27 13:23:43 UTC
Permalink
Sarah,

I don't know if this will work but due to previously unstable OSs I
have been waking my system from sleep by hitting the spacebar. It works
every time. When I used to move the mouse it would do what you said and
sometimes it would work. So I got in the habit of just tapping the
space bar once.

Maybe a mouse down sent to the space bar would also do the trick from
within REV????

I don't have the time right now to test it, Let me know if it works.

Tom
Post by Sarah Reichelt
I realize that I probably won't be able to wake the screen from sleep,
but I am tantalizingly close to being able to turn off the screen
saver. Has anyone else managed to do this? If it can't be done, I
guess I can always write myself a fake screen saver in Revolution, but
I would rather let the system do all the work :-)
Cheers,
Sarah
Thomas J. McGrath III
SCS
1000 Killarney Dr.
Pittsburgh, PA 15234
412-885-8541
Dar Scott
2004-04-27 17:26:55 UTC
Permalink
Post by Dar Scott
Post by Sarah Reichelt
I realize that I probably won't be able to wake the screen from sleep,
/usr/bin/pmset -a dim 0
I have slept on this, but have not tried it. You might use pmset -g to
get the "dim" setting, then the above to turn on the display and then
restore it. It has to run as root to make changes.

Dar
Brian Yennie
2004-04-27 07:37:59 UTC
Permalink
I dunno if this will help, but here was an old trick floating around
for playing the screen saver on your desktop:
Sarah Reichelt
2004-04-27 23:17:03 UTC
Permalink
Thanks to everyone for their suggestions, however none of them will do
what I need. Using either AppleScript's quit of the shell's kill (with
or without -9) works fine if you have started the screen saver by
pushing the mouse into the specified corner. If the screen saver has
come on after it's set time, both these methods stop the current screen
saver process but another one is immediately started.

The alternative techniques of moving the mouse or "pressing" the space
bar do nothing.

Thanks Dar, for the info about pmset - I'll test using that to wake up
the monitor after sleep. Meanwhile, I guess I just have to make my own
slide show screen saver :-(

Cheers,
Sarah
Dar Scott
2004-04-27 23:30:35 UTC
Permalink
Meanwhile, I guess I just have to make my own slide show screen saver
:-(
When life gives you lemons, make lemonade.

Maybe the screen saver could be black with a super large machine number
in grey. Or do your dancing logo thing. Or ...

Will you make this as part of your app with a system window or will you
make a screen saver plugin?

Dar Scott
Sarah Reichelt
2004-04-28 00:19:40 UTC
Permalink
Post by Dar Scott
Meanwhile, I guess I just have to make my own slide show screen saver
:-(
When life gives you lemons, make lemonade.
Maybe the screen saver could be black with a super large machine
number in grey. Or do your dancing logo thing. Or ..
I want a slide show of the images in my Pictures folder.
Post by Dar Scott
Will you make this as part of your app with a system window or will
you make a screen saver plugin?
Since I can't control the built-in screen saver, it will have to be
either part of my existing app, or maybe better as a second app that my
main app can start & stop.

Sarah
David Vaughan
2004-04-28 03:51:30 UTC
Permalink
Post by Sarah Reichelt
Thanks to everyone for their suggestions, however none of them will do
what I need. Using either AppleScript's quit of the shell's kill (with
or without -9) works fine if you have started the screen saver by
pushing the mouse into the specified corner. If the screen saver has
come on after it's set time, both these methods stop the current
screen saver process but another one is immediately started.
Sarah

What is the parent process ID of the new process that starts (try ps
-ajx)? Is it something else you can reasonably kill, so it will not
spawn further savers?

As an aside, I am wondering if these behaviours are related to a
problem I have where my Powerbook will occasionally refuse to wake
properly - the disk sounds are all as usual but the screen never clears
and the only resort is the reset button.

regards
David
Post by Sarah Reichelt
Cheers,
Sarah
Continue reading on narkive:
Loading...