A very simple hash tables explorer for searching items with the ability to search for wildmatches. Select you hash table in the menu, enter your search terms and go. A list of matched results will appear. Click on one of the matches and it will display the data in a editbox. If you enter any invalid params along the way, this script should prompt you as to what the error is.
/hashexp to open the dialog. If you have any issues, comments, or suggestions, don't hesitate to post them!
Regards.
dialog hashexp {
title "Hash tables explorer"
size -1 -1 210 179
option pixels
edit "", 1, 2 7 131 20
check "Se&arch for wildmatches ", 2, 4 129 131 17
button "&Search", 3, 134 5 70 20
list 4, 3 28 201 100, size
edit "", 5, 4 153 202 20, read autohs autovs
menu "File", 6
item "Select hash table", 7, 6
item "Close dialog", 8, 6
}
on *:dialog:hashexp:*:*:{
if ( $devent = sclick ) {
if ( $did = 3 ) {
%e = $($+(%,sel,.,hash),2)
did -r $dname 4
if ( $did($dname,1).text && %e ) {
var %x = 1
while ( $hget(%e,%x).item ) {
if ( $did($dname,2).state = 1 ) {
if ( $wildtok($hget(%e,%x).item,$+(*,$did($dname,1).text,*),1,32) ) did -a $dname 4 $ifmatch
}
elseif ( $hget(%e,%x).item = $did($dname,1).text ) did -a $dname 4 $v1
inc %x
}
if ( $did($dname,4).lines = 0 ) did -ra $dname 5 No matches found!
else did -ra $dname 5 Matched $did($dname,4).lines result(s)!
}
elseif ( !$did($dname,1).text ) did -ra $dname 5 No parameters!
elseif ( !%e ) did -ra $dname 5 No hash table selected!
}
if ( $did = 4 ) did -ra $dname 5 $hget(%sel.hash,$did($dname,4).seltext)
}
if ( $devent = menu ) {
if ( $did = 7 ) {
:start
var %i = $input(Enter hash table name:,eq,Hash table:)
if ( $($+(%,i),2) ) {
if ( $hget($ifmatch) ) set %sel.hash %i
else {
var %t = $input(Invalid hash table!,wr,Insufficient parameters)
if ( %t = $true ) goto start
}
}
else {
var %m = $input(No parameters..,wr,!)
if ( %m = $true ) goto start
}
}
if ( $did = 8 ) dialog -x $dname $dname
}
}
alias hashexp {
if ( !$dialog(hashexp) ) dialog -m hashexp hashexp
else dialog -v hashexp hashexp
}
5) The information would mess up the dialog in the list box...
4) I am going to add the feature to just list the items if no search so you can get an idea of what your looking for.
3) That should work fine. Tested multiple times and it worked for me. I\'ll run through a series of tests again, but I am pretty sure it works.
2) Should. If you enter an invalid hash table, it should give you the option to enter it again.
1) Yes. That was something I thought about too after I released this. I will update it today when I have a bit of extra time, most likely right now.
Thanks Scakk for your feedback.
1) It does not show me anywhere what Hash Table I am looking at.
2) It does not show confirmation that it found the Hash Table.
3) When I tried searhing in it the only way I found something was by using wildcard matches.
4) It seems to me the only way to find something is by guessing.
5) Perhaps have the list of information show in the list box?
Gj, just a few suggestions though:
1: In your dialog calling alias you can shorten it by doing something like this: alias hashexp dialog $iif($dialog(etc),-v hashexp hashexp,-m hashexp hashexp)
2: You could form this into a full editor and it\'d be even better.
I found this useful though as I need to check hash tables often.