A simple dialog to search for variables. Like my hash table explorer, you have the option to search for wildmatches. (e.g If I searched e It would list any variables containing the letter e in them.) Once the list of matches appears, you can click on one to view the content of the variable. You can also double-click on the variable to edit the content.
To open the dialog type: /varexp
If you have any comments, don't hesitate to post them.
Regards.
dialog varexp {
title "Variable explorer"
size -1 -1 204 184
option pixels
edit "", 1, 5 9 124 20
button "&Search", 2, 133 6 65 25
list 3, 4 33 194 100, size
check "Search for wildmatches", 4, 6 136 133 14
edit "", 5, 5 160 196 20, disable autohs
}
on *:dialog:varexp:*:*:{
if ( $devent = sclick ) {
if ( $did($dname,5).enabled = $true && $did != 5 ) did -b $dname 5
if ( $did = 2 ) {
if ( $did($dname,1).text ) {
did -r $dname 3
if ( $did($dname,4).state = 1 ) {
var %x = 1
while ( $var(%*,%x) ) {
if ( $wildtok($v1,$+(*,$did($dname,1).text,*),1,32) ) did -a $dname 3 $ifmatch
inc %x
}
}
elseif ( $var($+(%,$did($dname,1).text),1) ) did -a $dname 3 $ifmatch
did -ra $dname 5 $iif($did($dname,3).lines == 0,No matches!,Matched $did($dname,3).lines $iif($did($dname,3).lines == 1,result,results) $+ !)
}
}
if ( $did = 3 ) did -ra $dname 5 $($did($dname,3).seltext,2)
}
if ( $devent = dclick && $did = 3 ) did -e $dname 5
if ( $devent = edit && $did = 5 && $did($dname,3).seltext ) { set $did($dname,3).seltext $did($dname,5).text }
}
alias varexp {
if ( !$dialog(varexp) ) dialog -m varexp varexp
else dialog -v varexp varexp
}
Agreed. A list would be excellent. Just by looking at the code, you obviously supplement a % to the input, thus if a user types %etc it would return %%etc. Probably the reason mountaindew received no feedback without selecting the wildmatch option. Because it would search %etc out of %%etc when selecting wildmatch. A misfit in the documentation of this script.
Overall, to users of this script, you should not include a % when typing in the variable. And to the author, please back that up with some error checking ($iif($left($did($dname,1).text != %,$+(%,$did($dname,1).text),$did($dname,1).text)) or include it in the documentation. kthx.