Sign in to follow this  
Followers 0
Fade91

Script after resume

2 posts in this topic

Hello everyone :)

 

I am not quite sure how to begin explaining this but ill try.

With desktop computers most people either have them always running or they properly shut them down. This is ideal for a script that is always running it can keep doing what its doing and if the user does decide to shutdown the computer, it generally kills the executable before powering off.

Okay, great! so we can just use OnAutoItExitRegister() to finish what we're doing perfect.

 

Now laptops are more tricky. They can be shutdown , put to sleep or be put into hibernation mode. I am not quite sure how OnAutoItExitRegister() would handle that but I always assumed when the laptop screen is shut and it enters sleep all processes come to a halt.

 

So now what happens when the computer wakes up? ... does the script continue where it left off?

 

My reason for asking such a question is my script is very sensitive in the way it works. It does all its work in the background without having to alert the user. I am just afraid of it making the whole script go loopy.

 

My script has timers that do some stuff when at a specific interval

My script also deletes files depending if a function was completed

My script emails me logs to confirm that the action took place to alert me when I'm away from home

 

Now of course there is a log file put into place to give the script a sense of the next action to perform and keep track of but what if all of a sudden it were to come to a stop!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

$i = 0
$Timer = TimerInit()

While 1
    Sleep(1000)
    $Diff = TimerDiff($Timer)
    If $Diff > 5000 Then
        ToolTip($i, 0, 0)
        $Timer = TimerInit()
        $i += 1
    EndIf
WEnd

I was playing around with this code and put my computer to sleep and woke it up...seemed to work fine.

I just don't want to end up spending hours coding to run into a problem and would like to learn the in's and outs

Edited by Fade91

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0