Can a macro tell if it has been asleep?

Technical support and scripting issues

Moderators: JRL, Dorian Ellis

Can a macro tell if it has been asleep?

Postby Me_again » Thu Feb 16, 2012 9:18 pm

If a compiled macro (e.g. one that collects or sends data at regular intervals) is running on a PC that goes into sleep or hibernation mode, is there any system way for it to recognize that when it starts running again? Of course it could be constantly checking the previous timestamp but I'm wondering if there is a more sophisticated solution.
Me_again
Automation Wizard
 
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Postby JRL » Fri Feb 17, 2012 12:51 am

Of course it could be constantly checking the previous timestamp but I'm wondering if there is a more sophisticated solution.
Is this what you're NOT looking for? It works, and its not very sophisticated.


Code: Select all
VBSTART
VBEND

Label>Loop
  VBEval>timer,first_time
  Wait>1
  VBEval>timer-%first_time%,second_time
  If>Second_Time>10
    MDL>Second_Time=%Second_Time%  I must have been sleeping.
  EndIf
Goto>Loop
JRL
Automation Wizard
 
Posts: 2756
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Postby Me_again » Fri Feb 17, 2012 2:49 pm

Correct, that's not what I am looking for :) I was wondering if there is some accessible windows flag/indicator/variable that indicates a return from sleep/hibernation.
Me_again
Automation Wizard
 
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet

Postby JRL » Fri Feb 17, 2012 4:11 pm

How about a test for process logonui.exe?
JRL
Automation Wizard
 
Posts: 2756
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Postby Me_again » Tue Feb 21, 2012 5:00 am

Hmmm, good thought, but I suspect that doesn't run unless the system is setup to require a re-login. The solution appears to be Windows Power Management Events and I found a script for another automation program that monitors those notifications.
Me_again
Automation Wizard
 
Posts: 1101
Joined: Fri Jan 07, 2005 5:55 pm
Location: Somewhere else on the planet


Return to Technical / Scripting

Who is online

Users browsing this forum: No registered users and 1 guest