Jump to content
Sign in to follow this  

[Solved] Run script after resume from hibernation

Recommended Posts


Here is my problem: do a few actions, then hibernate Windows. When resuming from hibernation, do some other actions. I found a simple way, so I would like to share in case others have the same question. The difficult question was to run a script when Windows resume from hibernation.

1/ My first hint was to use "task schedule" in Windows. I tried to define a task that would run only when resuming from hibernation. Tasks offer many options (when login, at given times, etc.) but, at least in Windows 2000, no option to specify the task to run when the computer resumes from hibernation. So I gave up.

2/ I stumbled upon the software hibernate trigger. http://www.desimonesystems.com/suspendtrigger/index.php

This looked very promissing, and simple to use. Unfortunately, I never managed to launch an au3 script from this utility. It says that if you specify a file (au3 in my case) it would launch it with the default action. In my case, when I double click on an au3 file, my system is set-up to run the script. However, Hibernate Triger opens the script inside the editor. So I gave up this solution.

3/ I found in this forum a solution that detects resuming from hibernation.


This scripts works and has the advantage to detect a return from hibernation, even if the hibernation was not done by AutoIt.

4/ However, in my case, hibernation is done by AutoIt, so I settled for this extremely simple AutoIt script, that handles both the hibernation and the return from hibernation.

MsgBox(0,"Just before hibernate","Add code for actions to do before hibernation.")

; AutoIt tells Windows to hibernate

MsgBox(0,"Resume from hibernate","Add code for actions to do after resuming from hibernation.")

How simple is that? The trick here is to understand that the hibernate command "Shutdown(64)" does not end the script. So when Windows resumes, it just goes to execute the next line in script.

I hope this helps.

Share this post

Link to post
Share on other sites

Nice review,

but I'd like to clarify the problem with HibernateTrigger. As you mentioned, Hibernate Trigger uses system default action to execute its parameters. So if you want to use HT to execute a script you should compile it to be standalone .exe file. This will solve your problem and it works well on WinXP.

Best regards


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