mIRC Home    About    Download    Register    News    Help

Print Thread
#115293 24/03/05 04:30 PM
Joined: Mar 2005
Posts: 15
phishes Offline OP
Pikka bird
OP Offline
Pikka bird
Joined: Mar 2005
Posts: 15
Ok i got this

Code:
 
alias harddrives {
  var %a = 65,%d = 0
  while (%a <= 91) {
    if ($disk($chr(%a)).type == fixed) {
      var %f = $calc(%f + $disk($chr(%a)).free)
      var %s = $calc(%s + $disk($chr(%a)).size)
      inc %d
    }
    inc %a
  }
  return $iif($1 == total,%d,$iif($1 == free,%f,$iif($1 == size,%s)))
} 


//say Hdd's ( $+ $harddrives(total) $+ ): free: $bytes($harddrives(free),3k).suf total: $bytes($harddrives(size),3k).suf

but i want it to also show how much i've used, and be a bit more accurate. thanks for any help

#115294 24/03/05 06:36 PM
Joined: Jan 2003
Posts: 2,523
Q
Hoopy frood
Offline
Hoopy frood
Q
Joined: Jan 2003
Posts: 2,523
Where exactly is your problem?
used = size - free
so all you have to do is use $calc($haddrives(size) - $harddrivers(free))

Two notes:
1. There's no point in using both "3" and "k" in $bytes. "3" automatically picks the appropriate unit (B,KB,MB,GB etc) and overrides "k".
2. Looping through all letters three times (once for size, free and limit) is unecessarily slower. You could instead set variables for free, used and size in a single loop (and perhaps have $harddrives return them all in a row, when you call it with something like $harddrives(all)). If you don't want to do that, you can at least use $disk(N) (where N is a number and not a letter), so that if you have 10 drives on your system, it'll only do 10 iterations and not 24.

Last edited by qwerty; 24/03/05 06:44 PM.

/.timerQ 1 0 echo /.timerQ 1 0 $timer(Q).com

Link Copied to Clipboard