I made a responce to a post, with this, so i though i just stick it in a snippet.
Basic script, based on http://www.hawkee.com/snippet/7409/ script, just edited with a dialog instead of a menu :)
PREVIEW:
on 1:Join:%autochan:{
if $txt($nick) { mode # +v $nick }
}
menu * {
autovoice:/dialog -ma autov autov
}
dialog Autov {
Title Auto Voice
size -1 -1 208 125
option dbu
edit , 1, 3 3 200 10, disable, center
list 2, 3 14 100 100
button Add, 3, 105 20 30 30
button Remove, 4, 135 20 30 30
button Set Channel, 5, 165 20 35 30
list 6,165 50 35 79
list 7, 105 50 60 70
text $chan(%a) , 8, 90 112 30 10
button >, 9, 130 112 10 10
button <, 10, 120 112 10 10
}
on *:DIALOG:autov:init:*:{
$listp | set %a 1 | set %b 1 | $mychan | $mychans
}
alias -l mychan {
didtok autov 7 32 $regsubex($str(-,$nick($chan(%a),0)),/(.)/g,$+($nick($chan(%a),\n),$chr(32))) | did -o $dname 8 1 $upper($chan(%a))
}
on *:DIALOG:autov:sclick:*:{
if $did == 2 { did -u $dname 6 }
if $did == 3 {
if $txt($did(7,0).seltext) { did -o $dname 1 1 That user is all ready set to be voiced }
else { write autovoice.txt $address($did(7,0).seltext,2) | $reset | did -o $dname 1 1 Your entry has been added to the AutoVoice list }
}
if $did == 4 {
if $did(6,0).seltext { write $+(-ds,$address($did(6,0).seltext)) autovoice.txt | $reset | did -o $dname 1 1 Deleted }
elseif $did(2,0).seltext { write $+(-ds,$did(2,0).seltext) autovoice.txt | $reset | did -o $dname 1 1 Deleted }
}
if $did == 5 { $iif(!$did(6,0).seltext,did -o $dname 1 1 please select a channel,$notneed) }
if $did == 6 { did -u $dname 2 }
if $did == 7 {
if $read(autovoice.txt, s, $address(did(6.0).seltext,2)) isalnum { did-b $dname 3 | did -e $dname 4 }
else { did -e $dname 3 | did -b $dname 4 }
}
if $did == 9 {
inc %a
if !$check {
did -r $dname 7
$mychan
}
else { did -o $dname 1 1 Can not go any more that way (>) }
}
if $did == 10 {
dec %a
if !$check {
did -r $dname 7
$mychan
}
else { did -o $dname 1 1 Can not go any more that way (<) }
}
}
alias -l notneed {
set %autochan $did(6,0).seltext | did -o $dname 1 1 Setted autochannel to $did(6.0).seltext
}
alias -l check {
if !$chan(%a) { return $true }
}
alias -l listP {
if $read(autovoice.txt) == $null { write autovoice.txt hello }
var %len $calc($lines(autovoice.txt) +1) | var %a 1
:loop
if %len == %a { noop }
else { did -i $dname 2 %a $read(autovoice.txt, %a) | inc %a | goto loop }
}
alias -l mychans {
:loop
if $chan(%b) == $null { noop }
else { did -i $dname 6 %b $chan(%b) | inc %b | goto loop }
}
alias txt {
var %a 1 | var %b $calc($lines(autovoice.txt) + 1)
:loop
if %a == %b { noop }
else {
if $read(autovoice.txt, %a) == $address($1,2) { return $true }
else { inc %a | goto loop }
}
}
alias Reset {
var %a $dname
dialog -x $dname $dname
dialog -ma %a %a
}
dialog Autov {
title "Auto Voice"
size -1 -1 204 102
option dbu
edit "", 1, 3 3 200 10, disable center
list 2, 3 14 100 77, size
button "Add", 3, 104 14 29 10
button "Remove", 4, 135 14 28 10
button "Set Channel", 5, 167 14 34 10
list 6, 167 26 35 65, size
list 7, 104 26 60 65, size
text "$chan(%a)", 8, 72 93 30 10
button ">", 9, 112 91 10 10
button "<", 10, 102 91 10 10
}