hello, I am looking for a way to set up my laptop to do the following:
on battery:
always sleep on lid close no matter what. (easy)
on AC power:
always sleep on lid close unless uTorrent is running (or just when it is downloading)
I have tried setting uTorrent settings to prevent standby if there are active torrents but that doesn't prevent sleep on lid close.
-
I have used insomnia to accomplish this ( having DSL it is really needed for large DL's) Like you I do not want to constantly change my power plan!
I had this book marked
Give your computer insomnia [Free tool and source code to temporarily prevent a machine from going to sleep!] - Delay's Blog - Site Home - MSDN Blogs -
If you are running either Vista/ W7
Go to power option -> Click Choose what closing lid does -> Change Battery to Sleep, AC to Never
Change Utorrent Settings, Sleep After Downloading.
It is odd that utorrent didn't block the standby while downloading.
Try asking on the utorrent forum for support. You might get a better response than here. -
-
i ended up using autoit and made a script to do what i wanted.
if any of you use autoit and want this here is the script.
Code:Opt("TrayIconHide", 1) Global Const $WM_POWERBROADCAST = 0x0218 ; GUID_LIDSWITCH_STATE_CHANGE GUID ; 0xBA3E0F4D, 0xB817, 0x4094, 0xA2, 0xD1, 0xD5, 0x63, 0x79, 0xE6, 0xA0, 0xF3 Global Const $GUID_LIDSWITCH_STATE_CHANGE = DllStructCreate("byte[16]") DllStructSetData($GUID_LIDSWITCH_STATE_CHANGE, 1, Binary("0x4D0F3EBA17B89440A2D1D56379E6A0F3")) ; create gui and register notification Global $GUI = GUICreate("") GUIRegisterMsg($WM_POWERBROADCAST, "__WM_POWER") Global $hPower = DllCall("user32.dll", "handle", "RegisterPowerSettingNotification", "handle", $GUI, "ptr", DllStructGetPtr($GUID_LIDSWITCH_STATE_CHANGE), "dword", 0) ;GUISetState(@SW_HIDE) Do Until GUIGetMsg() = -3 ; unregister notification DllCall("user32.dll", "bool", "UnregisterPowerSettingNotification", "handle", $hPower[0]) Func __WM_POWER($hwnd, $msg, $wparam, $lparam) #forceref $hwnd Local Const $PBT_POWERSETTINGCHANGE = 0x8013 ; Data member is variable depending on notification ; the size of the Data member is returned in DataLength Local Const $POWERBROADCAST_SETTING = "byte[16];dword DataLength;byte Data" Switch $msg Case $WM_POWERBROADCAST Switch $wparam Case $PBT_POWERSETTINGCHANGE Local $PBT_PSC = DllStructCreate($POWERBROADCAST_SETTING, $lparam) ; GUID of registered notification is the first member of the structure Switch DllStructGetData($PBT_PSC, 1) Case DllStructGetData($GUID_LIDSWITCH_STATE_CHANGE, 1) ; for this notification, Data is an int representing the lid state Local $data = DllStructCreate("int", DllStructGetPtr($PBT_PSC, "Data")) _LidStateChange(DllStructGetData($data, 1)) ; Return 1 EndSwitch EndSwitch EndSwitch Return "GUI_RUNDEFMSG" EndFunc Func _LidStateChange($iState) Static $iPrevious = -1 If $iPrevious = -1 Then ; first fire, current state $iPrevious = $iState Return ElseIf $iPrevious = $iState Then Return Else $iPrevious = $iState EndIf ; lid state: ; 0 -> closed ; 1 -> open Switch $iState Case 0 ConsoleWrite("lid closed" & @CRLF) If NOT ProcessExists("uTorrent.exe") Then Shutdown(32) ;standby Endif If ProcessExists("uTorrent.exe") Then DllCall("user32.dll", "bool", "LockWorkStation") Endif Case 1 ConsoleWrite("lid opened" & @CRLF) EndSwitch EndFunc
Sleep on lid close Except when...
Discussion in 'Windows OS and Software' started by Pyro87, Jul 24, 2011.