; ; Language: English ; Platform: Win9x/NT ; Author: jgpaiva ; ; Script Function: ; Run the program passed as argument on cumputer unhibernation ; ; based on http://www.autohotkey.com/forum/topic21697.html #NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. SendMode Input ; Recommended for new scripts due to its superior speed and reliability. #SingleInstance,force ScriptName = RunOnUnhibernation ScriptVersion = 1.0 FileInstall,Cody.png,%A_ScriptDir%/cody.png,1 if 0 != 1 { msgbox,This program needs one command line parameter: the program to be launched on unhibernation`nJust drag and drop the program on to RunOnUnhibernation's executable, or make a shortcut with it as parameter.`nIf you'd like to have it launch several programs, just make a .bat file with that list! exitapp } Executable = %1% Menu,tray,add,About,About Menu,tray,add,Exit,Exit Menu,tray,Default,About Menu,tray,nostandard ; Listen to the Windows power event "WM_POWERBROADCAST" (ID: 0x218): OnMessage(0x218, "func_WM_POWERBROADCAST") Return /* This function is executed if the system sends a power event. Parameters wParam and lParam define the type of event: lParam: always 0 wParam: PBT_APMQUERYSUSPEND 0x0000 PBT_APMQUERYSTANDBY 0x0001 PBT_APMQUERYSUSPENDFAILED 0x0002 PBT_APMQUERYSTANDBYFAILED 0x0003 PBT_APMSUSPEND 0x0004 PBT_APMSTANDBY 0x0005 PBT_APMRESUMECRITICAL 0x0006 PBT_APMRESUMESUSPEND 0x0007 PBT_APMRESUMESTANDBY 0x0008 PBTF_APMRESUMEFROMFAILURE 0x00000001 PBT_APMBATTERYLOW 0x0009 PBT_APMPOWERSTATUSCHANGE 0x000A PBT_APMOEMEVENT 0x000B PBT_APMRESUMEAUTOMATIC 0x0012 Source: http://weblogs.asp.net/ralfw/archive/2003/09/09/26908.aspx */ func_WM_POWERBROADCAST(wParam, lParam) { Global Executable If (lParam = 0) { ; PBT_APMSUSPEND or PBT_APMSTANDBY? -> System will sleep If (wParam = 4 OR wParam = 5) { } ; PBT_APMRESUMESUSPEND oder PBT_APMRESUMESTANDBY? -> System wakes up If (wParam = 7 OR wParam = 8) { Run,%Executable% } } Return } about: gui,3:default IfExist %A_ScriptDir%\%ScriptName%.ico gui, Add , Picture, x15 y35,%A_ScriptDir%\%ScriptName%.ico else IfExist %A_ScriptDir%\%ScriptName%.exe gui, Add , Picture, x15 y35,%A_ScriptDir%\%ScriptName%.exe gui, Font,Bold s10 gui, Add ,Text,x65 y45,%ScriptName% V%ScriptVersion% by jgpaiva`n gui, Font, gui, Font, s10 gui, Add ,Text,x15 y95 w420 ,This is a small script that allows you to run a specific file (passed by command line argument) when the computer comes back from hibernation. gui, Add ,Text,X15 Y220,It was suggested by m0rph at DonationCoder.com forums, `nin the following thread: gui, Font,CBlue Underline gui, Add ,Text,X15 Y255 GPost,http://www.donationcoder.com/Forums/bb/index.php?topic=10009 gui, Font gui, Font, s10 gui, Add ,Text, y280 X15,`nPlease visit us at: gui, Font,CBlue Underline s10 gui, Add ,Text, y313 X15 GMainSite,http://www.donationcoder.com/ gui, Font IfExist,%A_ScriptDir%\Cody.png Gui, Add ,Picture, Y290 X280,%A_ScriptDir%\Cody.png gui, Add ,Button,y350 x15 gdonateAuthor w116 h30,Donate gui, Font, s9 gui, Add ,Text,y400 x15 h10,If you like this program please make a donation to help further development. gui, show gui,1:default return Post: Run,http://www.donationcoder.com/Forums/bb/index.php?topic=10009 GoSub,3GuiCLOSE return MainSite: Run,http://www.donationcoder.com/ GoSub,3Guiclose return DonateSite: Run,http://www.donationcoder.com/Donate/index.html GoSub,3Guiclose return DonateAuthor: Run,https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=jgpaiva`%40gmail`%2ecom&item_name`=donate`%20to`%20jgpaiva&item_number`=donationcoder`%2ecom&no_shipping=1&cn=Please`%20drop`%20me`%20a`%20line`%20`%3aD&tax`=0¤cy_code=EUR&bn=PP`%2dDonationsBF&charset=UTF`%2d8 GoSub,3Guiclose return 3GuiEscape: 3GuiClose: gui,3:destroy mutex:=false return exit: exitapp