au3如何禁用睡眠和休眠?
脚本运行时,禁止电脑进入睡眠或休眠状态。模拟鼠标移动能实现,但我想要直接设置禁用的方法实现,请高手帮帮忙,谢谢。。 找到一个禁用休眠的命令,禁用睡眠怎么实现?Runwait(@ComSpec & " /c " & 'powercfg -h off', "", @SW_HIDE) 结合系统命令实现吧!!wmic 或 bat 或 powershell什么的 http://msdn.microsoft.com/en-us/library/windows/desktop/aa373208%28v=vs.85%29.aspx
官网看到的,调用上面的例子(未测试)Func _PowerKeepAlive()
#cs
; Flags:
; ES_SYSTEM_REQUIRED(0x01) -> Resets system Idle timer
; ES_DISPLAY_REQUIRED (0x02) -> Resets display Idle timer
; ES_CONTINUOUS (0x80000000) -> Forces 'continuous mode' -> the above 2 will not need to continuously be reset
#ce
Local $aRet=DllCall('kernel32.dll','long','SetThreadExecutionState','long',0x80000003)
If @error Then Return SetError(2,@error,0x80000000)
Return $aRet ; Previous state (typically 0x80000000 [-2147483648])
EndFunc
页:
[1]