Re: wake notification in OS X
Re: wake notification in OS X
- Subject: Re: wake notification in OS X
- From: Donald Hall <email@hidden>
- Date: Thu, 29 May 2003 00:29:21 -0600
Jon,
Thanks for the reply. I have been thinking about the wake up problem
and have come up with a kludge for handling it. My test script
application is listed below. I've tested it a couple of times and it
seems to work. Obviously not the best solution - the script won't
realize the machine has been asleep until it reaches the top of the
idle handler again. This could be up to deltaT seconds later (plus
any time added to allow for what is going on in the main body of the
idle handler). In my case, the time that may be added is predictable;
what the idle handler is doing is inside a timeout block, so the
timeout value can be added in to predict the expected return time.
Your comments would be appreciated.
I had a look at the Konfabulator site, but couldn't find any
reference to wake up.
Regards,
Don
-- wake up test script application -----------------------------------
property deltaT : 5
global expectedReturnTime
on run
set expectedReturnTime to (current date) + deltaT --
intialize value, deltaT is arbitrary, idle starts 1st time right
after run
display dialog ("current date=" & (current date) as text) &
return & "expectedReturnTime=" & expectedReturnTime as text
end run
on idle
if expectedReturnTime < (current date) then
display dialog "late return by " & ((current date) -
expectedReturnTime) & " seconds" & return & ,
("current date=" & (current date) as text) &
return & "expectedReturnTime=" & expectedReturnTime as text
-- do wake up actions here
end if
set expectedReturnTime to (current date) + deltaT + 1 -- add
a bit of margin for loop overhead, etc
-- do stuff here, adjust expectedReturnTime as necessary,
depending on what 'stuff' is
beep
return deltaT
end idle
-- end script ---------------------------------------------------------
At 10:34 PM -0600 2003/05/28, Donald Hall wrote:
>
At 11:30 PM -0600 5/26/03, Donald Hall wrote:
>
>Is there any way in OS X for a script to be notified when the
>
>system wakes up? In OS 9 there was an event with a name something
>
>like <pmgtwake>, but OS X doesn't seem to have this. There must be
>
>some way that running applications get notified when the system
>
>wakes, including stay open scripts.
>
>
You need an application to tell you when the system wakes up. The
>
AppleEvent worked well and will probably be coming back some day,
>
but until then, I have one word to say: Konfabulator. It knows how
>
to do this. It can also be programmed in AppleScript. Sort of.
>
>
<http://www.konfabulator.com>
>
>
Jon
--
Donald S. Hall, Ph.D.
Apps & More Software Design, Inc.
email@hidden
http://www.appsandmore.com
_______________________________________________
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.