[color:green]; Usage: $diskn(N,type).prop
; Returns the Nth drive letter of the specified type.
; The <type> parameter is optional, if it is omitted,
; all existing disks are taken into account.
; If N is 0 (or non-numeric) it returns the
; total number of disks (of the specified type, if
; the <type> parameter is present)
; prop can be whichever property is supported by
; mIRC's $disk()
; Examples:
; $disk(0) -> returns the total number of drives
; $disk(3) -> returns the letter of the 3rd drive
; $disk(0,fixed) -> returns the total number of hard disk drives
; $disk(1,fixed) -> returns the letter of the 1st hard disk drive (normally C)
; $disk(2,cdrom).label -> returns the volume label of the 2nd CD-ROM drive[/color]
alias diskn {
if * !iswm $1 { return }
if !%drives { makedriveslist }
if $1 !isnum 1- { return $wildtok(%drives,$+(*:,$2,*),0,32) }
if $istok(type free label size unc,$prop,32) { return $disk($gettok($wildtok(%drives,$+(*:,$2,*),$1,32),1,58)). [ $+ [ $prop ] ] }
return $gettok($wildtok(%drives,$+(*:,$2,*),$1,32),1,58)
}
[color:green]; The following alias caches the drives info in a global
; variable named %drives, so that the $diskn() alias doesn't
; have to retrieve it every time.
; $diskn() re-retrieves the drives information if
; the %drives variable isn't found; so to clear the
; cached info and force an update just unset %drives
; A perhaps good idea is to call /makedriveslist
; during mIRC startup, with something like:
; on *:start: makedriveslist[/color]
alias makedriveslist {
unset %drives
var %i = 65
while %i < 91 {
if $disk($chr(%i)).type {
%drives = %drives $+($chr(%i),:,$ifmatch)
}
inc %i
}
}