Saturday, December 29, 2012

Want to Put your PC in Sleep mode by a simple shortcut ???
Step1: First download & install Autohotkey (just 2Mb simple program) from the below link. 
(Autohotkey is a very famous simple tool to automate ur work in windows.)

Step2: Save the below script as a sleep_PC.ahk file then open the sleep_pc.ahk. 
When you press Contorl + shift +f12 key in your computer, your computer is put to sleep instantly.
;****************************************************************************
^+F12::
        ES_SYSTEM_REQUIRED=0x00000001
        ES_DISPLAY_REQUIRED=0x00000002
        ES_USER_PRESENT=0x00000004
        ES_AWAYMODE_REQUIRED=0x00000040
        ES_CONTINUOUS=0x80000000
          
; ES_AWAYMODE_REQUIRED    Enables away mode. This value must be specified with ES_CONTINUOUS. 
; Away mode should be used only by media-recording and media-distribution applications that must perform critical background processing on desktop computers while the computer ;appears to be sleeping. See Remarks.

; Windows Server 2003 and Windows XP/2000:  ES_AWAYMODE_REQUIRED is not supported. 
; ES_CONTINUOUS: Informs the system that the state being set should remain in effect until the next call that uses ES_CONTINUOUS and one of the other state flags is cleared.
;       ES_DISPLAY_REQUIRED    Forces the display to be on by resetting the display idle timer.
;       ES_SYSTEM_REQUIRED    Forces the system to be in the working state by resetting the system idle timer.
; ES_USER_PRESENT This value is not supported. If ES_USER_PRESENT is combined with other esFlags values, the call will fail and none of the specified states will be set.
        
DllCall("SetThreadExecutionState", "Int", ES_CONTINUOUS + ES_SYSTEM_REQUIRED + ES_DISPLAY_REQUIRED)  ; avoid ES_USER_PRESENT ;Turn off previos call which might prevent Suspend
DllCall("PowrProf\SetSuspendState", "int", 0, "int", 0, "int", 0)               ; SLEEP
Return
;****************************************************************************

More Interested in this topic ? Click below:
http://www.autohotkey.com/board/topic/88618-shortcut-to-sleep-neither-hibernate-nor-hybrid-sleep/

Know more about AutoHotKey from the below link.
http://www.autohotkey.com/docs/Tutorial.htm

No comments:

Post a Comment