8November2011
Greetings.
I have a maybe a dozen WTM-related AHK scripts.
Here is a modified/enhanced version of what I already posted»
scrX := 1
Perc := "%"
If (pos = 14) or ((pos = 19) and (CN = "T"))
{
CPU100 := 1
If (SS = "C98") or (SS = "M")
Process, Priority
, %scrPID%, AboveNormal
CPUlim := CPUlim+1
}
else
{
If (CN <> "T")
If (CPUU > 90)
{
CPU100 := 1
CPUlim := CPUlim+1
FileAppend, CPUU ¦
%CuDa%@
%CuTi% ¦
%CPUU% ¦ SS:
%SS% ¦ CPUlim:
%CPUlim% `n
, %PFa%\ahk\
%CN%%SNt2%.txt
}
else CPU100 := 0
}
which can be used to test for CPU usage (CPUU) at 100 or 90 or any %;
I have but do not often use the SysIntern ProX.
I (like IainB & StoicJo) started watching the XP WTM
(I have always sorted like StoicJo posted) a long time ago -
mostly because I hate trying to work on an unresponsive computer.
The PC is largely unresponsive to the user & processes in general when CPUU is 100%.
(I have never found the trick of lowering the priority of the resource hog to be effective.
Lowering the priority allows other exes to grap CPUU but does not lower CPUU from 100%,
If there is interest I could post some other WTM-related scripts.
These other scripts mostly (re-)position the XP WTM.
I always have the XP WTM open & in the lower right corner.
One of my AHK scripts short-circuits/supercharges my XP "AppsKey" (AK).
For example, when the XP WTM is active & I hit the AK,
the script(s) will reposition the the XP WTM various ways ...»
WTMinWTMin is for when I want the XP WTM to take up the least screen real estate ...
WTMregWTMreg is for when the XP WTM doesn't need to be minimized/maximized ...
All I need to do is Alt-Tab to the WTM & then Ctrl-(Shift)-Tab between the Task/Processes/Summary ...
WTMaxWTMmax is for when I need to maximize the XP WTM ...
In any case, the CPUtimes script reports the CPU usage to a TrayTip - not a variable.
I'm hoping to see a script example of how to have the CPU usage
of the active window reported to a variable ...-AEN007
The GetProcessTimes(), GetSystemTimes() and GetIdleTimes() functions in that script return the data you want. It's up to you dump that data into a variable:myVar := GetSystemTimes()
; myVar will now contain the total CPU load at that moment.
; Now do whatever you need to do with the variable and data.
-skwire
Greetings & thanks for the reply ...
I have already been trying to do what you have posted,
but it has not been working for me.
I can get from the XP WTM what GetSystemTimes provides.
I want to put GetProcessTimes into a variable at any given moment.
I have used Sean's TrayIcons() & TaskButtons() in many scripts, like ...
If (WxX = 0)
{
TBEE := TaskButtons("explorer.exe")
idnNWC := idnT
HideButton(idnNWC, False)
HideButton(idnNWC, True)
}
Those TrayIcons() & TaskButtons script/functions reside in the AHK\Lib "PATH".
I should be able to access/use CPUTimes.ahk the same way, ja?
I have already tried the following»
GPTpid := AWpid
GST := GetSystemTimes()
GPT := GetProcessTimes(GPTpid)
GST & GPT are always blank ...
Any helpful replies/insights appreciated ...