Search the Community
Showing results for tags 'suspend'.
Found 2 results
with the below code, I am keeping waiting for a particular file and waiting in the background. While $i <> 10 Sleep(60000) If FileExists(@ScriptDir&"\Binaries.ini") then --some processing-- $i = 10 endif WEnd I thought keeping the Sleep will freeze the process from resources but the CPU being uilized.But it is taking 47%. How to free this CPU usage also.?
I have a light bulb which I can turn on and off using UDP commands (I already have that working in AutoIt). What I would like to do is run a script before the computer goes to sleep to turn it off, and after it resumes to turn it on. I've already got the latter working, but not the former. I tried Task Scheduler with the kernel power log, but the command doesn't get executed until the computer resumes from sleep. I've tried some things using WM_POWERBROADCAST, but so far I haven't got that to work either. Here's what I've got so far: Global Const $WM_POWERBROADCAST = 0x218 Global Const $PBT_APMSUSPEND = 0x4 Global Const $PBT_APMRESUMEAUTOMATIC = 0x12 While 1 Sleep(100) WEnd GUICreate("Event Receiver") GUIRegisterMsg($WM_POWERBROADCAST,"MY_WM_POWERBROADCAST") Func MY_WM_POWERBROADCAST($hWnd, $uMsg, $wParam, $lParam) Switch $wParam Case $PBT_APMSUSPEND MsgBox(0,"PBT_APMSUSPEND","PBT_APMSUSPEND"&@HOUR&@MIN&@SEC) Case $PBT_APMRESUMEAUTOMATIC MsgBox(0,"PBT_APMSUSPEND","PBT_APMRESUMEAUTOMATIC"&@HOUR&@MIN&@SEC) EndSwitch EndFunc Does anyone know how to make this work?