Holmesware Posted August 7, 2008 Posted August 7, 2008 Please helpI've been trying to figure out how I can close my mail program (Eudora) before TrueCrypt dismounts an encrypted file container when the system goes into standby/hibernation. I have a script that will work for shutdown:DllCall("kernel32.dll", "int", "SetProcessShutdownParameters", "long", 0x3FF, "long", 0);makes this program get a "Shutdown" message before other programs RunWait(IniRead("EES.ini","Program","Location","Not Found")); Read the location of Eudora.exe from the INI file Func OnAutoItExit(); Distinguished function name runs when this program is signaled to shut down If @ExitMethod = 4 Then CloseEudora(); Shutting down, so shut down Eudora EndFunc Func CloseEudora() ; This will run before most programs get shut down, e.g. TrueCrypt $PID = ProcessExists("Eudora.exe"); Will return the PID or 0 if the process isn't found. If $PID Then ProcessClose($PID); ProcessWaitClose($PID); EndIf EndFuncI believe the VB script is this, just not sure how to get it into AutoIt.Set wmiPowerManagementEvent = GetObject("winmgmts:").ExecNotificationQuery("Select * from Win32_PowerManagementEvent")If wmiPowerManagementEvent.NextEvent.EventType = 4 Then <do stuff>here is a link to that may help. http://msdn.microsoft.com/en-us/library/aa394362(VS.85).aspxI've tried the AutoIt Scriptomatic but there is no entry for Win32_PowerManagementEventThanks so much for your help, I have 3 consultants wanting this script.
BrettF Posted August 7, 2008 Posted August 7, 2008 Dim $strComputer = "localhost", $message_title, $message_content $oBJ = ObjGet ("winmgmts:\\" & $strComputer & "\root\cimv2") $event = $oBJ.ExecNotificationQuery("Select * from Win32_PowerManagementEvent") $ret = $event.NextEvent.EventType Switch $ret Case 4 $message_title = "Entering Suspend" $message_content = "Indicates that the computer is about to enter the suspended state." Case 7 $message_title = "Resume from Suspend" $message_content = "Indicates that a ResumeSuspend message has been sent, enabling the computer to return to its regular power state." Case 10 $message_title = "Power Status Change" $message_content = "Indicates a change in the power status of the computer, such as a switch from battery power to AC, or from AC to an uninterruptible power supply" Case 11 $message_title = "OEM Event" $message_content = "Indicates that an Advanced Power Management (APM) BIOS has sent an OEM event" Case 18 $message_title = "Resume Automatic" $message_content = "Indicates that the computer has awakened in response to an event" EndSwitch MsgBox (0, $message_title, $message_content) Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
passkalilo Posted May 29, 2009 Posted May 29, 2009 Very good, thanks but I want to know how to block the standby/hibernate after detected the event? Anything else?
BrettF Posted May 29, 2009 Posted May 29, 2009 Search for aborting shutdown on the forums... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
BrettF Posted May 29, 2009 Posted May 29, 2009 Never PM me or another user EVER again asking for help, unless they tell you. Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now