Re: [AHK-] 有辦法偵測CPU是否閒置嗎?
雖然我在網路上找到了範例, 但現在有遇到一個問題,
想請問一下面這段判斷式...
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)
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 2 之 3 篇):
EzHotKey 近期熱門文章
PTT數位生活區 即時熱門文章