Jump to content

Hibernate


Ejoc
 Share

Recommended Posts

So I didn't, until now, use Hibernate because I have an AES Encrypted Disk Volume and Hibernate keeps the volume decrypted when returning from Hibernate. So I wrote a little script to close certain windows and processes if they are running and then Hibernate. When you come back from Hibernating it will run commands( In my case prompt me for a password to remount the Encrypted Volume).

My only "problem" is that 1/2 the time when returning from Hibernate the popup window is minimized. I'm open to suggestions :)

I increased the delays since I would from time to time have problems w/ files not being written before I disconnect the disk. So I guess I should add: Use at Own Risk

#cs
vi:ts=4 sw=4:
    Hibernate.au3
    Close certain apps before hibernating, Usefull for unmounting AES
    encrypted drives and apps running off of them
    It will close windows w/ titles contained in $lpTitles
    It will close processes contained in $lpProcess
    When the system returns from hibernating it will execute the
    commands in $lpRestart
    Ejoc
    3/30/05
#ce
#include <GUIConstants.au3>
#notrayicon
Opt("WinTitleMatchMode",2)

Global $lpTitles    = StringSplit("Mozilla|GVIM|Adobe Photoshop","|")
Global $lpProcess   = StringSplit("PrvDisk.exe|hh.exe","|")
Global $lpRestart   = StringSplit("D:\Encrypted Disk N.dpd","|")

For $i = 1 To $lpTitles[0]
    While WinExists($lpTitles[$i])
        WinClose($lpTitles[$i])
        Sleep(500)
    Wend
Next

Sleep(3000)

For $i = 1 To $lpProcess[0]
    While ProcessExists($lpProcess[$i])
        ProcessClose($lpProcess[$i])
        Sleep(500)
    Wend
Next

DllCall("powrprof.dll","none","SetSuspendState")
;System is Hibernating
MsgBox(0,"Back from Hibernate","Press ok when you have returned")

For $i = 1 To $lpRestart[0]
    Run(@comspec & " /c " & Chr(34) & $lpRestart[$i] & Chr(34),"",@SW_HIDE)
    Sleep(250)
Next
Edited by Ejoc
Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs
Link to comment
Share on other sites

After increasing the delays I always have the popup waiting for me. I also added the Mozilla apps to the $lpProcess, works good for me now:

#cs
vi:ts=4 sw=4:
    Hibernate.au3
    Close certain apps before hibernating, Usefull for unmounting AES
    encrypted drives and apps running off of them
    It will close windows w/ titles contained in $lpTitles
    It will close processes contained in $lpProcess
    When the system returns from hibernating it will execute the
    commands in $lpRestart
    Ejoc
    3/30/05
#ce
#include <GUIConstants.au3>
#notrayicon
Opt("WinTitleMatchMode",2)

Global $lpTitles    = StringSplit("Mozilla|GVIM|Adobe Photoshop","|")
Global $lpProcess   = StringSplit("firefox.exe|thunderbird.exe|sunbird.exe|hh.exe|PrvDisk.exe","|")
Global $lpRestart   = StringSplit("D:\Encrypted Disk N.dpd","|")

For $i = 1 To $lpTitles[0]
    While WinExists($lpTitles[$i])
        WinClose($lpTitles[$i])
        Sleep(500)
    Wend
Next

Sleep(3000)

For $i = 1 To $lpProcess[0]
    While ProcessExists($lpProcess[$i])
        ProcessClose($lpProcess[$i])
        Sleep(500)
    Wend
Next

Sleep(3000)

DllCall("powrprof.dll","none","SetSuspendState")
;System is Hibernating
MsgBox(0,"Back from Hibernate","Press ok when you have returned")

For $i = 1 To $lpRestart[0]
    Run(@comspec & " /c " & Chr(34) & $lpRestart[$i] & Chr(34),"",@SW_HIDE)
    Sleep(500)
Next
Start -> Programs -> AutoIt v3 -> AutoIt Help File -> Index -> (The Function you are asking about)----- Links -----DllStruct UDFsRSA Crypto UDFs
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...