Archive

Posts Tagged ‘mIRC’

hdd.mrc – Show harddrive statistics

;;;; HDD Listing v1.3.1 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Written by:                                                                ;;
;;   Brian Schmidt aka. brianMan.                                             ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Readme / Help ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Load this script in mIRC, if you don't know how to do this, then perhaps   ;;
;; you shouldn't be using this script.                                        ;;
;;                                                                            ;;
;; Simple script, wich many others have allready made in various forms and    ;;
;; shapes, that very simple lists all harddrives connected, their sizes,      ;;
;; free space, and a total size/total free space.                             ;;
;;                                                                            ;;
;; Commands available:                                                        ;;
;;   /hdd                                                                     ;;
;;   /hdd total                                                               ;;
;;   /hdd drives                                                              ;;
;;   /hdd C                                                                   ;;
;;                                                                            ;;
;; Identifiers available:                                                     ;;
;;   $hdd                                                                     ;;
;;   $hdd(0).total                                                            ;;
;;   $hdd(0).totalfree                                                        ;;
;;   $hdd(0).totalfreeprc                                                     ;;
;;   $hdd(0).c                                                                ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;; Changelog ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; v1.3.1                                                                     ;;
;; * Corrected a few $csize to $bytes                                         ;;
;; * Changed the format the HDD info was output                               ;;
;;                                                                            ;;
;; v1.3.0                                                                     ;;
;; + Removed the csise.mrc dependency, now uses built-in $bytes instead       ;;
;;                                                                            ;;
;; v1.2.0                                                                     ;;
;; + Added drive specific calls, both as identifiers and regular output       ;;
;;                                                                            ;;
;; v1.1.0                                                                     ;;
;; - Moved the "Convert Size" to external script "csize.mrc".                 ;;
;; + Added identifiers for use in other scripts.                              ;;
;; + Can now be called with "total" and "drives" options                      ;;
;;                                                                            ;;
;; v1.0.0                                                                     ;;
;; + Initial release.                                                         ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

alias hdd {
    var %num = 99
    var %i = 0
    if ($len($prop) == 1 || $len($1) == 1) {
        if ($isid == $true) {
            var %HD.tmp = $prop
        }
        else {
            var %HD.tmp = $1
        }
        if ($disk(%HD.tmp)) {
            var %HD.single = $upper(%HD.tmp) $+ : Capacity: $bytes($disk(%HD.tmp).size).suf $+ . Used: $bytes($calc($disk(%HD.tmp).size - $disk(%HD.tmp).free)).suf ( $+ $round($calc(($disk(%HD.tmp).size - $disk(%HD.tmp).free) / $disk(%HD.tmp).size * 100),1) $+ $chr(37) $+ ) Free: $bytes($disk(%HD.tmp).free).suf ( $+ $round($calc($disk(%HD.tmp).free / $disk(%HD.tmp).size * 100),1) $+ $chr(37) $+ )
        }
        else {
            var %HD.single = No such drive: $upper(%HD.tmp) $+ :
        }
    }
    else {
        while ( %num <= 122 ) {
            inc %i
            if ($disk($chr(%num))) {
                if (%num > 99) {
                    var %HD.out = %HD.out -
                }
                var %HD.out = %HD.out $upper($chr(%num)) $+ : $bytes($disk($chr(%num)).free).suf $+ / $+ $bytes($disk($chr(%num)).size).suf ( $+ $round($calc($disk($chr(%num)).free / $disk($chr(%num)).size * 100),1) $+ $chr(37) $+ )
                var %HD.total = $calc(%HD.total + $disk($chr(%num)).size)
                var %HD.totalfree = $calc(%HD.totalfree + $disk($chr(%num)).free)
            }
            inc %num
        }
    }
    if ($isid == $true) {
        if ($prop == total) {
            return %HD.total
        }
        elseif ($prop == totalfree) {
            return %HD.totalfree
        }
        elseif ($prop == totalfreeprc) {
            return $round($calc(%HD.totalfree / %HD.total * 100),1)
        }
        elseif (%HD.single) {
            return %HD.single
        }
        else {
            return %i
        }
    }
    if ($1 == total) {
        msg $active Free total: $bytes(%HD.totalfree).suf $+ / $+ $bytes(%HD.total).suf ( $+ $round($calc(%HD.totalfree / %HD.total * 100),1) $+ $chr(37) $+ )
    }
    elseif ($1 == drives) {
        msg $active Free: %HD.out
    }
    elseif (%HD.single) {
        msg $active %HD.single
    }
    else {
        msg $active Free: %HD.out
        msg $active Free total: $bytes(%HD.totalfree).suf $+ / $+ $bytes(%HD.total).suf ( $+ $round($calc(%HD.totalfree / %HD.total * 100),1) $+ $chr(37) $+ )
    }
}
Categories: Code Tags: , ,