#####################################################################
# Название: Change Words Style v1.0
# Автор: Epic (http://epicnet.ru, irc.epicnet.ru:6667 #Code)
# Описание: Изменяет внешнее оформление слов в тексте, которые были определены в диалоговом окне настроек.
#####################################################################
menu menubar,channel,query {
Change Words Style: cws
}
on *:INPUT:*:{
if ($left($1,1) != /) && (!$ctrlenter) {
var %repnicks $1- | var %i 1 | while (%i <= $0) {
var %w $remove($gettok($1-,%i,32),$chr(44),$chr(46),?,!)
if (%w ison $chan) %repnicks = $replace(%repnicks,%w,$+(%cws_nc1,%w,%cws_nc2)) | inc %i
}
var %repwords %repnicks | var %l $lines(%cws_words) | var %i 1 | while (%i <= %l) {
var %srt $read(%cws_words,%i) | var %w1 $gettok(%srt,1,10132) | var %w2 $gettok(%srt,2,10132)
if ($+(*,%w1,*) iswm %repnicks) %repwords = $replace(%repwords,%w1,%w2) | inc %i
}
if (%repwords !isin $1-) { say %repwords | halt }
}
}
---------------------------------------------------------------------
alias cws { %cws_words = $scriptdir $+ words.txt | if ($dialog(cws)) .dialog -x cws | .dialog -m cws cws }
dialog cws {
title "Change Words Style"
size -1 -1 350 340
option pixels
icon $mircexe,59
;------------
edit %cws_nc1, 1, 73 28 67 20, autohs
edit %cws_nc2, 2, 210 28 67 20, autohs
text "+ Nick +", 3, 145 31 60 20, center
box "", 4, 145 22 60 26
box "", 5, 10 5 330 60
;------------
box "", 10, 10 70 330 230
text "Word:", 11, 39 88 90 15
text "New style:", 12, 195 88 90 15
edit "", 13, 37 103 120 20, autohs
edit "", 14, 193 103 120 20, autohs
box "", 15, 160 97 30 26
text "➔", 16, 160 106 30 20, center
list 20, 37 135 210 148, extsel
button "Add", 21, 256 170 63 23, flat
button "Edit", 22, 256 200 63 23, flat
button "Del", 23, 256 230 63 23, flat
;------------
button "Apply", 100, 100 309 75 23, flat ok
button "Cancel", 101, 182 309 75 23, flat cancel
}
on *:DIALOG:cws:init:0: var %i 1 | while (%i <= $lines(%cws_words)) { .did -a cws 20 $read(%cws_words,%i) | inc %i }
on *:DIALOG:cws:dclick:20:{
var %ws $did($dname,20,1).seltext | .did -i $dname 13 1 $gettok(%ws,1,10132) | .did -i $dname 14 1 $gettok(%ws,2,10132)
}
on *:DIALOG:cws:sclick:21:{
if ($did(13).text && $did(14).text) {
var %wt $did(13).text ➔ $did(14).text
if (!$read(%cws_words,wn,%wt)) { .did -i $dname 20 1 %wt | .write -il1 %cws_words %wt | echo -a 03This has been saved: %wt }
else { var %r $readn | .did -c $dname 20 %r | echo -a 04This set of words is already in the line: $+([,%r,]) }
} | else echo -a 04Please fill in two fields to save the words.
}
on *:DIALOG:cws:sclick:22:{
var %wl $did($dname,20,1).sel
if ($did(13).text && $did(14).text && %wl) {
var %wt $did(13).text ➔ $did(14).text
if (!$read(%cws_words,wn,%wt)) { .did -co $dname 20 %wl %wt | .write $+(-l,%wl) %cws_words %wt | echo -a 03Line changed: $+([,%wl,]) }
else { var %r $readn | .did -c $dname 20 %r | echo -a 04This set of words is already in the line: $+([,%r,]) }
} | else echo -a 04To edit, double-click a line and fill in the fields..
}
on *:DIALOG:cws:sclick:23:{
var %ws $did($dname,20,0).sel | echo -a 03Lines removed: $+([,%ws,])
var %i 1 | while (%i <= %ws) { var %wl $did($dname,20,1).sel | .did -d $dname 20 %wl | .write $+(-dl,%wl) %cws_words | inc %i }
}
on *:DIALOG:cws:sclick:100: if ($did(1).text) set %cws_nc1 $did(1).text | if ($did(2).text) set %cws_nc2 $did(2).text
---------------------------------------------------------------------