;Usage /HLIST HASHTABLENAME CMD
;* HASHTABLENAME is any hashtable name wildcards allowed
;* CMD is any mirc command or alias, The CMD well be envoked once with only $1=hashtableNAME
;* then well be envoked repeatedly with $1=hashtableNAME $2=hashtableITEM $3-=hashtableVALUE
;* should a second hashtable also meet any wildcard matching the next table well then be processed as above through CMD
;*NB : It is important to remember that $1 $2 $3 when passed as part of CMD well be should not be evaluated prior to passing ie: you use $!1 $!2 $!3-
;
;Example usage can be found in /HTLW (hashtable list window)
;
alias hlist {
if ($2) {
var %i = $hget(0)
while (%i) {
if ($1 iswm $hget(%i)) {
var %tempfile = $+(Delete_Me_Im_A_Temp_File.,$ticks,$mid($rand(1000000,1999999),2),.txt)
write -c %tempfile | hsave -iou $hget(%i) %tempfile
filter -cffxctu 1 61 %tempfile %tempfile [hashtable]
set -l %temp1 $iif($var(%hlist.hashtable,0),%hlist.hashtable) | set %hlist.hashtable $hget(%i)
set -l %temp2 $iif($var(%hlist.command ,0),%hlist.command) | set %hlist.command $2-
hlistitem | ; *** This line produces the CMD with only $1=hashtableNAME defined, so if you dont want that remark this out ***
filter -fk %tempfile hlistitem
$iif(!%temp1,unset,set) %hlist.hashtable %temp1
$iif(!%temp2,unset,set) %hlist.command %temp2
.remove %tempfile
}
dec %i
}
}
}
;
alias -l hlistitem {
if ($pos($1,=,1)) tokenize 32 $left($1-,$calc($v1 - 1)) $mid($1-,$calc($v1 + 1))
tokenize 32 %hlist.hashtable $1-
;echo -st table is $1 : item is $2 : value is $3-
$(%hlist.command,2)
}
;
alias htlw {
window -t30,60 @htw
aline @htw Name $chr(9) Item $chr(9) Value
hlist $iif($1,$1,*) aline @htw $!1 $chr(9) $!2 $chr(9) $!3-
}