作者ShineX (........)
站内EzHotKey
标题Re: [AHK-] 有办法侦测CPU是否闲置吗?
时间Fri Nov 7 14:40:02 2008
虽然我在网路上找到了范例, 但现在有遇到一个问题,
想请问一下面这段判断式...
If A_TimeIdlePhysical>=%idleduration%
{
...
}
这个判断式中的 A_TimeIdlePhysical,
应该是系统没有收到任何输入(滑鼠和键盘的输入都"忽略")的时间吧?
但是我发现只有我键盘或滑鼠有动作, A_TimeIdlePhysical就会reset
我有印出来看过...
p.s. A_TimeIdle 则是"不忽略"滑鼠和键盘的输入
请问这是啥麽问题, 谢谢!!!
程式原始档
http://www.donationcoder.com/Software/Skrommel/IdleRun/IdleRun.ahk
再line 47
而且我认为作者的line 46
If load>%cputhreshold%
应该也写错了, 该改成 If load<%cputhreshold%,
不然这个程式就该改成 BusyRun 了, 不是IdleRun XD
A_TimeIdle和A_TimeIdlePhysical的说明:
A_TimeIdle:
The number of milliseconds that have elapsed since the system last
received keyboard, mouse, or other input. This is useful for determining
whether the user is away. This variable will be blank unless the operating
system is Windows 2000, XP, or beyond. Physical input from the user as well
as artificial input generated by any program or script (such as the Send or
MouseMove commands) will reset this value back to zero. Since this value
tends to increase by increments of 10, do not check whether it is equal to
another value. Instead, check whether it is greater or less than another
value. For example: IfGreater, A_TimeIdle, 600000, MsgBox, The last keyboard
or mouse activity was at least 10 minutes ago.
A_TimeIdlePhysical:
Same as above but ignores artificial keystrokes and/or
mouse clicks whenever the corresponding hook (keyboard or mouse) is
installed. If neither hook is installed, this variable is equivalent to
A_TimeIdle. If only one hook is present, only that one type of artificial
input will be ignored. A_TimeIdlePhysical may be more useful than A_TimeIdle
for determining whether the user is truly present.
※ 引述《ShineX (........)》之铭言:
: 我的问题就如标题,
: 想用AutoScript在CPU闲置时, 送key到某个视窗,
: 但似乎没看到类似的侦测指令...
: 目前有想到:
: 搭配别的程式来侦测CPU是否闲置 (但还没找到可跟AHK搭配的程式 >"<)
: 有推荐的吗?
: 另外如果AHK有办法侦测CPU是否闲置的话, 有办法也针测硬碟吗?
: 谢谢!!!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 220.128.88.200
※ 编辑: ShineX 来自: 220.128.88.200 (11/07 14:40)