找回密码
 加入
搜索
查看: 2195|回复: 3

[AU3基础] au3如何禁用睡眠和休眠?

[复制链接]
发表于 2013-11-20 19:43:43 | 显示全部楼层 |阅读模式
脚本运行时,禁止电脑进入睡眠或休眠状态。模拟鼠标移动能实现,但我想要直接设置禁用的方法实现,请高手帮帮忙,谢谢。。
 楼主| 发表于 2013-11-20 20:23:06 | 显示全部楼层
找到一个禁用休眠的命令,禁用睡眠怎么实现?

Runwait(@ComSpec & " /c " & 'powercfg -h off', "", @SW_HIDE)
发表于 2013-11-20 20:49:20 | 显示全部楼层
结合系统命令实现吧!!wmic 或 bat 或 powershell什么的
发表于 2013-11-21 17:10:35 | 显示全部楼层
http://msdn.microsoft.com/en-us/ ... 8%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[0]    ; Previous state (typically 0x80000000 [-2147483648])
EndFunc
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-10-6 12:31 , Processed in 0.103188 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表