alias coolmonnetwstats {
var %cpu $left($dll(darkenginex.dll,cpuload,_),3)
; if wscript.exe isn't running but coolmon.exe is, $isprocess returns 2
; (10 in binary: the first bit, which corresponds to the first process
; that you specified (wscript.exe), is 0. The 2nd bit (coolmon.exe) is 1)
if (%cpu <= 60 && $isprocess(wscript.exe|coolmon.exe) == 2) {
write -cn "C:\Program Files\CoolMon\extensions\CoolMon Network Result Time.txt" $asctime(HH:nn:ss)
run "networkStatus v2.1.vbs"
inc %counter.netwupdate
inc %counter.netwupdateloop
if ( %counter.netwupdateloop = 500 ) {
echo -ts CoolMon Network Status-update n° $+ %counter.netwupdate completed...
%counter.netwupdateloop = 0
}
}
.timernetwstats 1 5 coolmonnetwstats
}
alias isprocess {
; checks if process(es) exist(s)
; $isprocess(<process1[|process2|process3|...]>[,N]) - returns 1 if there's an Nth process for <process>, otherwise 0.
; if more than one process names are specified, N is assumed 1 and $isprocess() returns a number where each bit
; represent each process in the list: if the Mth process in the list isn't running, the Mth bit of that number will
; be 0, otherwise 1. To check if process3 is running, for example, you'd do either this:
; if ($isbit($isprocess(proc1|proc2|proc3),3))
; or this:
; if ($isprocess(proc1|proc2|proc3) & 4)
; (if you don't understand the 2nd example, just use $isbit())
; example: if ($isprocess(mirc.exe,1)) { .echo -q $endprocess(mirc.exe,1) }
if ($isid) {
if ($2 !isnum 1- || *|* iswm $1) { tokenize 32 $$1 1 }
var %a = a $+ $ticks, %b = b $+ $ticks, %c = c $+ $ticks
.comopen %a WbemScripting.SWbemLocator
if ($com(%a)) {
.comclose %a $com(%a,ConnectServer,3,dispatch* %b)
if ($com(%b)) {
.comclose %b $com(%b,ExecQuery,3,string,SELECT Name FROM Win32_Process WHERE Name =" $+ $replace($1",|," OR Name ="),dispatch* %c)
if ($com(%c)) {
var %result = 0
if *|* iswm $1 {
var %i = 1, %f = $calc(2^ $numtok($1,124) -1)
while %result != %f && $comval(%c,%i,Name) != $null {
%result = $biton(%result,$findtok($1,$v1,124))
inc %i
}
}
elseif if $comval(%c,0) >= $2 {
%result = 1
}
.comclose %c
return %result
}
}
}
}
}