Acro Help - 25/01/03 02:25 AM
I m current using this script for acronyms but only replaces the acro on the beginning of the phrase if the acro is on the middle it doesn't replace I trie dto fix it by myself but it didn't work
any way to make it work ? here is the code
thanks!
any way to make it work ? here is the code
Code:
; ###### Aliases ###### alias Acronyms { if $dialog(Acronyms) = Acronyms halt | dialog -m Acronyms Acronyms } alias Acronyms.read { return $readini -n " $+ $mircdiracronyms\acronyms.ini $+ " $1 $2 } alias Acronyms.letter { if $dialog(Acronyms.letter) = Acronyms.letter halt | dialog -m Acronyms.letter Acronyms.letter } alias Acronyms.row { if $dialog(Acronyms.row) = Acronyms.row halt | dialog -m Acronyms.row Acronyms.row } alias Acronyms.rem { remini " $+ $mircdirAcronyms\acronyms.ini $+ " $1 $2 } alias Acronyms.add { writeini " $+ $mircdirAcronyms\acronyms.ini $+ " $1 $2 $3- } alias Acronyms.list { did -ra $dname 4 $Acronyms.read(LONGLIST,1) | did -r $dname 2 var %Acronyms.tmp = 0 :Acrolist inc %Acronyms.tmp 1 if ($Acronyms.read(SHORTLIST,%Acronyms.tmp) != $null) { did -a $dname 2 $Acronyms.read(SHORTLIST,%Acronyms.tmp) | goto Acrolist } did -c $dname 2 1 } ;This part below are talkers my friend mike made, i just changed the alias $identifier to Acrotalk/Acrotalk2. alias Acrotalk2 { unset %moontalk %i = 1 %temp = $replace($1-,$chr(32),$chr(160)) :next if ($mid(%temp,%i,1) != $null) { if ( 2 // %i ) { set %coler %Acronyms.1.Colour } else { set %coler %Acronyms.2.Colour } %moontalk = %moontalk $+ $+ %coler $+ $mid(%temp,%i,1) $+ $chr(3) inc %i goto next } else { { return %moontalk } } } alias Acrotalk { unset %moontalk %i = 1 %temp = $replace($1-,$chr(32),$chr(160)) %moontalk = $chr(3) $+ %Acronyms.1.Colour $+ $mid(%temp,%i,1) inc %i :next if ( $mid(%temp,$calc(%i - 1),1) == $chr(160) ) { %moontalk = %moontalk $+ $chr(3) $+ %Acronyms.1.Colour $+ $mid(%temp,%i,1) inc %i goto next } elseif ( $mid(%temp,%i,1) != $null ) { %moontalk = %moontalk $+ $chr(3) $+ %Acronyms.2.Colour $+ $mid(%temp,%i,1) $+ $chr(3) inc %i goto next } else { { return %moontalk } } } ; ###### Dialogs ###### Dialog Acronyms { title "Acronyms Replacer - Author: cHrIs^o^" size -1 -1 313 200 box "Acronyms Translations - Options:", 1, 5 5 300 90 combo 2, 10 25 70 200, drop text "=", 3, 90 28 10 25 edit "", 4, 105 26 130 20, disable button "Delete", 5, 245 26 50 20 edit "", 6, 10 50 70 40, multi hsbar text "=", 7, 90 55 10 25 edit "", 8, 105 50 130 40, multi hsbar button "Add", 9, 245 55 50 20 box "Acronyms Translations - Colour/Color:", 10, 5 100 300 70 button " ", 11, 10 120 145 25 button " ", 12, 160 120 140 25 button "OK", 13, 130 177 55 20, ok check "Combine Colour/Color's", 14, 100 147 235 20 check "Active", 15, 245 175 235 20 } Dialog Acronyms.letter { title "Acronyms Colour/Color" size -1 -1 125 60 option dbu icon 1,1 1 21 20,Acronyms\0.bmp icon 2,15 1 21 20,Acronyms\1.bmp icon 3,30 1 21 20,Acronyms\2.bmp icon 4,45 1 21 20,Acronyms\3.bmp icon 5,60 1 21 20,Acronyms\4.bmp icon 6,75 1 21 20,Acronyms\5.bmp icon 7,90 1 21 20,Acronyms\6.bmp icon 8,105 1 21 20,Acronyms\7.bmp icon 9,1 15 21 20,Acronyms\8.bmp icon 10,15 15 21 20,Acronyms\9.bmp icon 11,30 15 21 20,Acronyms\10.bmp icon 12,45 15 21 20,Acronyms\11.bmp icon 13,60 15 21 20,Acronyms\12.bmp icon 14,75 15 21 20,Acronyms\13.bmp icon 15,90 15 21 20,Acronyms\14.bmp icon 16,105 15 21 20,Acronyms\15.bmp text "Click on a Colour/Color box than hit 'OK' to save.", 17, 5 35 120 25 button "OK", 18, 50 45 27 10, ok } Dialog Acronyms.row { title "Acronyms Colour/Color" size -1 -1 125 60 option dbu icon 1,1 1 21 20,Acronyms\0.bmp icon 2,15 1 21 20,Acronyms\1.bmp icon 3,30 1 21 20,Acronyms\2.bmp icon 4,45 1 21 20,Acronyms\3.bmp icon 5,60 1 21 20,Acronyms\4.bmp icon 6,75 1 21 20,Acronyms\5.bmp icon 7,90 1 21 20,Acronyms\6.bmp icon 8,105 1 21 20,Acronyms\7.bmp icon 9,1 15 21 20,Acronyms\8.bmp icon 10,15 15 21 20,Acronyms\9.bmp icon 11,30 15 21 20,Acronyms\10.bmp icon 12,45 15 21 20,Acronyms\11.bmp icon 13,60 15 21 20,Acronyms\12.bmp icon 14,75 15 21 20,Acronyms\13.bmp icon 15,90 15 21 20,Acronyms\14.bmp icon 16,105 15 21 20,Acronyms\15.bmp text "Click on a Colour/Color box than hit 'OK' to save.", 17, 5 35 120 25 button "OK", 18, 50 45 27 10, ok } on *:Dialog:Acronyms.row:*:*: { if ($devent == sclick) { if ($did == 1) { set %Acronyms.2.Colour 0 | did -ra Acronyms 12 Rest Of The Word: 0 } if ($did == 2) { set %Acronyms.2.Colour 1 | did -ra Acronyms 12 Rest Of The Word: 1 } if ($did == 3) { set %Acronyms.2.Colour 2 | did -ra Acronyms 12 Rest Of The Word: 2 } if ($did == 4) { set %Acronyms.2.Colour 3 | did -ra Acronyms 12 Rest Of The Word: 3 } if ($did == 5) { set %Acronyms.2.Colour 4 | did -ra Acronyms 12 Rest Of The Word: 4 } if ($did == 6) { set %Acronyms.2.Colour 5 | did -ra Acronyms 12 Rest Of The Word: 5 } if ($did == 7) { set %Acronyms.2.Colour 6 | did -ra Acronyms 12 Rest Of The Word: 6 } if ($did == 8) { set %Acronyms.2.Colour 7 | did -ra Acronyms 12 Rest Of The Word: 7 } if ($did == 9) { set %Acronyms.2.Colour 8 | did -ra Acronyms 12 Rest Of The Word: 8 } if ($did == 10) { set %Acronyms.2.Colour 9 | did -ra Acronyms 12 Rest Of The Word: 9 } if ($did == 11) { set %Acronyms.2.Colour 10 | did -ra Acronyms 12 Rest Of The Word: 10 } if ($did == 12) { set %Acronyms.2.Colour 11 | did -ra Acronyms 12 Rest Of The Word: 11 } if ($did == 13) { set %Acronyms.2.Colour 12 | did -ra Acronyms 12 Rest Of The Word: 12 } if ($did == 14) { set %Acronyms.2.Colour 13 | did -ra Acronyms 12 Rest Of The Word: 13 } if ($did == 15) { set %Acronyms.2.Colour 14 | did -ra Acronyms 12 Rest Of The Word: 14 } if ($did == 16) { set %Acronyms.2.Colour 15 | did -ra Acronyms 12 Rest Of The Word: 15 } } } on *:Dialog:Acronyms.letter:*:*: { if ($devent == sclick) { if ($did == 1) { set %Acronyms.1.Colour 0 | did -ra Acronyms 11 First Letter: 0 } if ($did == 2) { set %Acronyms.1.Colour 1 | did -ra Acronyms 11 First Letter: 1 } if ($did == 3) { set %Acronyms.1.Colour 2 | did -ra Acronyms 11 First Letter: 2 } if ($did == 4) { set %Acronyms.1.Colour 3 | did -ra Acronyms 11 First Letter: 3 } if ($did == 5) { set %Acronyms.1.Colour 4 | did -ra Acronyms 11 First Letter: 4 } if ($did == 6) { set %Acronyms.1.Colour 5 | did -ra Acronyms 11 First Letter: 5 } if ($did == 7) { set %Acronyms.1.Colour 6 | did -ra Acronyms 11 First Letter: 6 } if ($did == 8) { set %Acronyms.1.Colour 7 | did -ra Acronyms 11 First Letter: 7 } if ($did == 9) { set %Acronyms.1.Colour 8 | did -ra Acronyms 11 First Letter: 8 } if ($did == 10) { set %Acronyms.1.Colour 9 | did -ra Acronyms 11 First Letter: 9 } if ($did == 11) { set %Acronyms.1.Colour 10 | did -ra Acronyms 11 First Letter: 10 } if ($did == 12) { set %Acronyms.1.Colour 11 | did -ra Acronyms 11 First Letter: 11 } if ($did == 13) { set %Acronyms.1.Colour 12 | did -ra Acronyms 11 First Letter: 12 } if ($did == 14) { set %Acronyms.1.Colour 13 | did -ra Acronyms 11 First Letter: 13 } if ($did == 15) { set %Acronyms.1.Colour 14 | did -ra Acronyms 11 First Letter: 14 } if ($did == 16) { set %Acronyms.1.Colour 15 | did -ra Acronyms 11 First Letter: 15 } } } on *:Dialog:Acronyms:*:*: { if ($devent == sclick) { if ($did == 14) { if ($did($dname,14).state == 1) { set %Acronyms.C.Colour on } if ($did($dname,14).state == 0) { set %Acronyms.C.Colour off } } if ($did == 15) { if ($did($dname,15).state == 1) { set %Acronyms on | did -e $dname 14,12,11,10,9,8,7,6,5,3,2,1 } if ($did($dname,15).state == 0) { set %Acronyms off | did -b $dname 14,12,11,10,9,8,7,6,5,3,2,1 } } if ($did == 11) { .timer -m 1 1 /Acronyms.letter } if ($did == 12) { .timer -m 1 1 /Acronyms.row } if ($did == 2) { did -bra $dname 4 $Acronyms.Read(LONGLIST,$did($dname,2).sel) } if ($did == 5) { var %Acronyms.tmp2 = $calc($did($dname,2).sel - 1) :Acrorem inc %Acronyms.tmp2 1 if ($Acronyms.read(SHORTLIST,$calc(%Acronyms.tmp2 + 1)) == $null) { goto end } Acronyms.rem SHORTLIST %Acronyms.tmp2 Acronyms.add SHORTLIST %Acronyms.tmp2 $Acronyms.read(SHORTLIST,$calc(%Acronyms.tmp2 + 1)) Acronyms.rem LONGLIST %Acronyms.tmp2 Acronyms.add LONGLIST %Acronyms.tmp2 $Acronyms.read(LONGLIST,$calc(%Acronyms.tmp2 + 1)) goto Acrorem :end Acronyms.rem SHORTLIST %Acronyms.tmp2 Acronyms.rem LONGLIST %Acronyms.tmp2 Acronyms.list } if ($did == 9) { var %Acronyms.tmp3 = 0 :Acroadd inc %Acronyms.tmp3 1 if ($Acronyms.read(SHORTLIST,%Acronyms.tmp3) != $null) { goto Acroadd } else { Acronyms.add SHORTLIST %Acronyms.tmp3 $did($dname,6).text | Acronyms.add LONGLIST %Acronyms.tmp3 $did($dname,8).text } did -r $dname 6 | did -r $dname 8 | Acronyms.list } } if ($devent == init) { Acronyms.list did -a $dname 11 First Letter: %Acronyms.1.Colour did -a $dname 12 Rest Of The Word: %Acronyms.2.Colour if (%Acronyms.C.Colour == ON) { did -c $dname 14 } if (%Acronyms == ON) { did -c $dname 15 | did -e $dname 14,12,11,10,9,8,7,6,5,3,2,1 } if (%Acronyms == OFF) { did -b $dname 14,12,11,10,9,8,7,6,5,4,3,2,1 } } } ; ###### Remote ###### on 1:input:*: { if ($left($1,1) == /){ return } else { if (%Acronyms == on) { var %Acronyms.temp = 0 :Acrocheck inc %Acronyms.temp 1 if ($1- isin $Acronyms.read(SHORTLIST,%Acronyms.temp)) { set %Acrotext $Acronyms.read(LONGLIST,%Acronyms.temp) | goto Acrotalk } if ($Acronyms.read(SHORTLIST,%Acronyms.temp) != $null) { goto Acrocheck } :Acrotalk if (%Acronyms.C.Colour == on) { set %acrotmp2 $Acronyms.read(SHORTLIST,%Acronyms.temp) set %tmp2 $Acrotalk2(%acrotext) say $replace($1-,%Acrotmp2,%tmp2) | halt } else { set %acrotmp $Acronyms.read(SHORTLIST,%Acronyms.temp) set %tmp $Acrotalk(%Acrotext) say $replace($1-,%Acrotmp,%tmp) | halt } } } }
thanks!