Hash tables explorer

By LiQuiDFLamE on Nov 21, 2007

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
}

Comments

Sign in to comment.
Ghost-writer   -  Nov 22, 2009

Great, i love it :)

 Respond  
guest598594   -  Nov 24, 2007

i type trivia, finds nothing
i click select hash table, type trivia, finds nothing
:/

i also suggest that u list out the hash tables, cuz i dont know what half of my hash tables are called

 Respond  
LiQuiDFLamE   -  Nov 23, 2007

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.

 Respond  
Scakk   -  Nov 23, 2007

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?

 Respond  
LiQuiDFLamE   -  Nov 22, 2007

Thanks brinxy. :) I am currently working on a hash editor and will release it soon. This is something I made while working on some other projects as I use hash tables more often now. I will also take the dialog calling idea into account for the future.

 Respond  
brinxy   -  Nov 22, 2007

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.

 Respond  
LiQuiDFLamE   -  Nov 22, 2007

Any feedback?

 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.