more questions for acro script... - 27/01/05 04:47 PM
hello again,
i have 2 questions for my script.
FIRST, i was thinking of adding the ability to edit an entry that already exists in the hash, but have only been able to succesfully recall the item into editbox. when i try to pull the item's data, the way the code is now it just duplicates the item name in the data editbox..(hope i'm explaining this ok..)
and secondly, have some check boxes (alough i originaly wanted to use radios) to select options but i'm having a problem with having it when is checked the other is deactivated.. they both call on a readini alais and it presents a problem when both are set on. how would somthing like this be done?
here's the code :
the code in red is where the my questions lies..
if anyone could help,, thanks in advance
i have 2 questions for my script.
FIRST, i was thinking of adding the ability to edit an entry that already exists in the hash, but have only been able to succesfully recall the item into editbox. when i try to pull the item's data, the way the code is now it just duplicates the item name in the data editbox..(hope i'm explaining this ok..)
and secondly, have some check boxes (alough i originaly wanted to use radios) to select options but i'm having a problem with having it when is checked the other is deactivated.. they both call on a readini alais and it presents a problem when both are set on. how would somthing like this be done?
here's the code :
Code:
on *:INPUT:*:{ if ( $left($1,1) != / ) { acro $1- } } alias -l amsw { writeini -n $+(",$mircdirdat\ini\,$1,") $2 $3 $$4- } alias -l amsr return $readini $+",$mircdirdat\ini\,$1,"),n,$2,$$3) alias -l acro { var %i = $getacro($1-) if (%i) { msg $active %i halt } } alias -l getacro { if (!$hget(amacros)) { return } var %i = 1 var %r while ($gettok($1-,%i,32)) { var %j = $v1 if ($hget(amacros,%j)) { %j = $v1 } %r = %r %j inc %i } if ($amsr(settings.ini,Acro,colorcaps) == On) { return $colorcap(%r) } elseif ($amsr(settings.ini,Acro,rcolorcaps) == On) { return $rcolorcap(%r) } else return %r } alias -l colorcap { var %v = 1, %u while $gettok($1,%v,32) != $null { %u = %u %ac1 $+ $upper($left($v1,1)) $+ %ac2 $+ $mid($v1,2) inc %v } return %u } alias -l rcolorcap { var %v = 1, %u while $gettok($1,%v,32) != $null { %u = %u $+ $rand(3,14) $+ $upper($left($v1,1)) $+ $+ $rand(3,14) $+ $mid($v1,2) inc %v } return %u } dialog acro_test { title $amlogo ACRONYMS size -1 -1 314 200 option dbu list 1, 16 64 82 107, size vsbar edit "", 3, 16 46 82 10 edit "", 4, 147 46 150 10 list 2, 147 64 149 107, size vsbar button "Add Acro", 5, 91 25 37 9 button "Del Acro", 6, 133 25 37 9 text "-= Input TexT =-", 7, 30 35 41 8 text "-= Output TexT =-", 8, 202 35 45 8 text "A", 9, 120 56 4 8 text "C", 10, 120 69 5 7 text "R", 11, 120 81 5 7 text "O", 12, 120 93 5 7 text "N", 13, 120 105 4 7 text "Y", 14, 120 117 4 8 text "M", 15, 120 129 5 8 text "S", 16, 120 141 4 8 button "Okay", 17, 104 186 37 12, ok button "Ascii Table", 18, 111 13 37 9 text "-= OR =-", 21, 247 15 20 7 check "Enable Acro Colors", 20, 225 6 63 9 check "Enable Random Colors", 19, 225 21 65 9 } on *:dialog:acro_test:*:*: { if ($devent == init) { if !$hget(amacros) { hamke amacros 100 | hload amacros $amshdir(amsacros.hsh) } var %x = 1 while $hget(amacros,%x).item { did -a $dname 1 $v1 inc %x } var %y = 1 while $hget(amacros,%y).data { did -a $dname 2 $v1 inc %y } if ($amsr(settings.ini,Acro,colorcaps) == On) { did -c $dname 20 } if ($amsr(settings.ini,Acro,rcolorcaps) == On) { did -c $dname 19 } } [color:red] if ($devent == dclick) { if ($did == 1) { if $did(1).seltext || $did(2).seltext { $hget(amacros).item { did -a $dname 3 $v1 } $hget(amacros,$v1).data { did -a $dname 4 $v1 } } } } [/color] if ($devent == sclick) { if ($did == 5) { if ($did($dname,3) == $null) && ($did($dname,4) != $null) { $awarno | $awarnc } elseif ($did($dname,4) == $null) && ($did($dname,3) != $null) { $awarno | $awarnc } else { if ($hget(amacros)) { hadd amacros $did($dname,3).text $did(acro_test,4).text did -a acro_test 1 $did($dname,3).text did -a acro_test 2 $did($dname,4).text did -r $dname 3,4 } } } if ($did == 6) { if ($did(acro_test,1).sel) { if ($hget(amacros)) { set %line $did(acro_test,1).sel hdel amacros $did(acro_test,1).seltext did -d acro_test 1 %line did -d acro_test 2 %line } } } if ($did == 18) { odialog ascii_table ascii_table } [color:red]if ($did == 19) { /amsw settings.ini Acro rcolorcaps $iif($did(19).state,On,Off)) /amsw settings.ini Acro colorcaps $iif($did(20).state,Off,On)) } if ($did == 20) { /amsw settings.ini Acro colorcaps $iif($did(20).state,On,Off)) /amsw settings.ini Acro rcolorcaps $iif($did(19).state,Off,On)) } } [/color] if ($devent == close) { if ($dialog(ascii_table)) { dialog -x ascii_table } .hsave -o amacros dat\hsh\amsacros.hsh } }
the code in red is where the my questions lies..
if anyone could help,, thanks in advance