-= (A)(M) =- Acros Script — File Browser

AM-AcrosScriptv1.2 / AM-AcrosScriptv1.2 / amacros.mrc

amacros.mrc — 14.44 KB — Download this file

#amacro on
on *:START:{
  if !$hget(amacros) { .hmake amacros 10 }
  if !$hget(amacroset) { .hmake amacroset 2 }
  if ($isfile($scriptdiramacros.hsh)) { .hload amacros $scriptdiramacros.hsh }
  if ($isfile($scriptdiramacroset.hsh)) { .hload amacroset $scriptdiramacroset.hsh }
}
on *:LOAD:{
  if ($version < 6.16) {
    echo -s This Script REQUIRES Mirc ver 6.16 or higher to run
    unload -rs amacros.mrc
  }
  else { dialog -m welcome welcome | .timerwclose 1 10 if ($dialog(welcome)) { dialog -x welcome } }
}
on *:INPUT:*:{ if (($left($1,1) != /) && (!$ctrlenter)) { acro $1- } }
alias -l acro { if ($getacro($1-)) { /say $v1 | halt } }
alias -l getacro {
  if (!$hget(amacros) || $hget(amacroset, am_acro)) { return }
  tokenize 32 $1-
  var %i = $0 , %r
  while (%i) {
    var %w = $($+($,%i),2)
    if ($hget(amacros,%w)) {
      var %w = $v1
      if ($hget(amacroset, am_Acroplain)) { %w = $pacros(%w) }
      elseif ($hget(amacroset, am_Acrocaps)) { %w = $acaps(%w) }
      elseif ($hget(amacroset, am_Acroccaps)) { %w = $ccap(%w) }
      elseif ($hget(amacroset, am_Acrorcaps)) { %w = $rccap(%w) }
      if ($hget(amacroset, ama_backgroundset)) && $hget(amacroset, am_Acroccaps) { %w = $ccbg(%w) } 
      if ($hget(amacroset, ama_Bold)) { %w = $+(,%w,) }
      if ($hget(amacroset, ama_Underline)) { %w = $+(­,%w,­) }
      if ($hget(amacroset, ama_Reverse)) { %w = $+(,%w,) }

    } 
    var %r = %w %r
    dec %i
  }
  return %r
}
alias -l pacros {
  tokenize 32 $1- | var %i = $0 , %r , %w
  while (%i) { %w = $($+($,%i),2) | %r = $+($lower($left(%w,1)),$mid(%w,2)) %r | dec %i } 
  return %r 
} 
alias -l acaps {
  tokenize 32 $1- | var %i = $0 , %r , %w
  while (%i) { %w = $($+($,%i),2) | %r = $+($upper($left(%w,1)),$mid(%w,2)) %r | dec %i } 
  return %r 
} 
alias -l ccap { 
  tokenize 32 $1- | var %i = $0 , %r , %w
  while (%i) {
    %c1 = $+($chr(3),$hget(amacroset, am_ac1)) | %c2 = $+($chr(3),$hget(amacroset, am_ac2))
    %w = $($+($,%i),2) | %r = $+(%c1,$upper($left(%w,1)),%c2,$mid(%w,2),$chr(3)) %r | dec %i 
  } 
  return %r 
} 
alias -l rccap { 
  tokenize 32 $1- | var %i = $0 , %r , %w
  while (%i) { %w = $($+($,%i),2) | %r = $+(,$rand(3,14),$upper($left(%w,1)),,$rand(3,14),$mid(%w,2),) %r | dec %i } 
  return %r 
}
alias -l ccbg {
  tokenize 32 $1- | var %i = $0 , %r , %w
  while (%i) {
    %c1 = $+(,$hget(amacroset, am_ac1),$chr(44),$hget(amacroset, am_bgc))
    %w = $($+($,%i),2) | %r = $+(%c1,$upper($left(%w,1)),$mid(%w,2),$chr(3)) %r | dec %i 
  }
  return %r 
}

dialog acro_main {
  title -= (A)(M) =- ACRO SYSTEM    Ver: 1.2   By: clutz1572 
  size -1 -1 314 200
  option dbu
  list 1, 16 64 82 107, size vsbar
  edit "", 3, 16 46 82 10
  edit "", 4, 154 46 150 10
  list 2, 155 64 149 107, size vsbar
  button "Add Acro", 5, 32 12 37 9, disable
  button "Del Acro", 6, 117 12 37 9, disable
  text "-= Input TexT =-", 7, 30 35 46 8
  text "-= Output TexT =-", 8, 202 35 48 8
  edit "", 9, 119 154 16 10, read center
  text "Total # Of Acros", 10, 108 143 40 8
  button "About", 11, 20 185 37 12
  button "Options", 12, 109 105 37 9
  button "Finished", 17, 117 185 37 12, ok
  button "Ascii Table", 18, 109 72 37 9
  button "Edit Acro", 25, 208 12 37 9, disable
  button "Colors", 23, 109 89 37 9
  button "HELP!", 24, 237 185 37 12
}
on *:dialog:acro_main:*:*: { 
  if ($devent == init) { 
    if !$hget(amacros) { hmake amacros 10 | hload amacros $scriptdiramacros.hsh } 
    else { hload amacros $scriptdiramacros.hsh }
    var %i = 1 
    while $hget(amacros,%i).item { 
      did -a $dname 1 $v1 
      did -a $dname 2 $hget(amacros,$v1) 
      inc %i 
    } 
    if $hget(amacros,0).item < 10 { did -a $dname 9 0 $+ $hget(amacros,0).item }
    else { did -a $dname 9 $hget(amacros,0).item }
  }
  if ($devent == dclick) { 
    if $did(1).sel || $did(2).sel { 
      set %acro_temp $v1 
      did -ra $dname 3 $did(1,$v1) | did -ra $dname 4 $did(2,$v1) | did -b $dname 5 | did -e $dname 25
    } 
    else unset %acro_temp 
  } 
  if ($devent == rclick) {
    did -r $dname 3,4 | did -ra $dname 25 Edit Acro | did -b $dname 5,6,25
  }
  if ($devent == sclick) { 
    if $did isnum 1-2 && ($did(1).sel || $did(2).sel) {
      did -e $dname 6
    }
    if ($did == 1) { did -c $dname 2 $did(1).sel }
    if ($did == 2) { did -c $dname 1 $did(2).sel } 
    elseif ($did == 5) { 
      if $did(3) == $null || $did(4) == $null { $awarn | return } 
      elseif $didwm(1,$did(3)) && $input (OK to add this $did(3) acro?,u,Acros) { 
        did -a $dname 1 $didwm(1,$did(3)) $did(3) | did -a $dname 2 $didwm(1,$did(3)) $did(4) 
      } 
      else { did -a $dname 1 $did(3) | did -a $dname 2 $did(4) } 
      if ($hget(amacros)) { hadd amacros $did($dname,3).text $did($dname,4).text } 
      did -r $dname 3,4 | did -b $dname 5 

      if $hget(amacros,0).item < 10 { did -ra $dname 9 0 $+ $hget(amacros,0).item }
      else { did -ra $dname 9 $hget(amacros,0).item }
    }
    elseif ($did == 6) { 
      if $did(1).sel || $did(2).sel { 
        var %a = $v1 
        if ($hget(amacros)) { hdel amacros $did(1,%a) } 
        did -d $dname 1,2 %a | did -b $dname 5,6,25 
        if $hget(amacros,0).item < 10 { did -ra $dname 9 0 $+ $hget(amacros,0).item }
        else { did -ra $dname 9 $hget(amacros,0).item }
      } 
    } 
    elseif ($did == 12) { if $dialog(options) { dialog -v options } | else { dialog -m options options } }
    elseif ($did == 18) { if $dialog(ascii_table) { dialog -v ascii_table } | else { dialog -m ascii_table ascii_table } }
    elseif ($did == 23) { if $dialog(acro_color) { dialog -v acro_color } | else { dialog -m acro_color acro_color } }
    elseif ($did == 25) { if $dialog(acro_edit) { dialog -v acro_edit } | else { dialog -m acro_edit acro_edit } }
  } 
  if ($devent == edit) { 
    if $did(25) != OK && $did(3).edited && $did(4).edited { did -e $dname 5 } 
  }
  if ($devent == close) {
    if $dialog(ascii_table) { dialog -x ascii_table } | if $dialog(acro_color) { dialog -x acro_color } 
    if $dialog(options) { dialog -x options } | if $dialog(acro_edit) { dialog -x acro_edit }
    .hsave amacros $scriptdiramacros.hsh
    .hsave amacroset $scriptdiramacroset.hsh
    unset %acro_temp 
  }  
}
dialog ascii_table {
  title -= (A)(M) =- Ascii  Table ( Extra Characters ) 
  size -1 -1 218 177
  option dbu
  list 1, 11 20 26 112
  list 2, 54 49 26 104
  list 3, 130 49 26 104
  list 4, 177 21 26 112
  button "Add", 5, 90 73 29 9
  button "Done", 6, 87 166 37 9, ok
  box "Upper Case", 7, 4 4 41 157
  box "Lower Case", 8, 49 35 38 126
  box "Numeric", 9, 122 35 40 126
  box "Misc", 10, 166 4 50 157
  text "A", 11, 68 11 4 8
  text "S", 12, 76 13 4 8
  text "C", 13, 83 12 4 8
  text "I", 14, 90 11 2 8
  text "I", 15, 96 13 2 8
  text "T", 16, 104 12 4 8
  text "A", 17, 111 11 4 8
  text "B", 18, 118 13 4 8
  text "L", 19, 125 12 3 8
  text "E", 20, 132 11 4 8
  edit "", 21, 97 86 15 13
  text Double Click On Characters, 22, 68 22 68 8
}
on *:dialog:ascii_table:*:*:{
  if ($devent == init) {
    didtok $dname 1 44 À,Á,Â,Ã,Ä,Å,ß,Ç,Ð,È,É,Ê,Ê,Ë,Ì,Í,Î,Ï,Ñ,Ò,Ó,Ô,Õ,Ö,Ù,Ú,Û,Ü,Ý,¥
    didtok $dname 2 44 à,á,â,ã,ä,å,ç,è,é,ê,ë,ì,í,î,ï,ñ,ò,ó,ô,õ,ö,ù,ú,û,ü,ý,ÿ
    didtok $dname 3 44 ø,¹,²,³,×,÷,¢,£,¼,½,¾
    didtok $dname 4 44 ª,º,°,©,®,¡,¿,¤,§,«,»,¬,±,µ,¶,þ,Þ,Æ,æ,ð,¸,‘,’
  }
  if ($devent == sclick) {
    if ($did == 5) { 
      if ($did($dname,21) == $null) { $asciiwarno }
      elseif $dialog(acro_edit) {
        var %a = $did(acro_edit,2)  
        did -ra acro_edit 2 $+($left(%a,$did(acro_edit,2).selstart),$did(21),$mid(%a,$calc(1+$did(acro_edit,2).selend)))
        did -v acro_edit 6 $did(21) | did -r $dname 21 
      }
      else { did -a acro_main 4 %acro_temp $did(21) | did -r $dname 21 } 
    }
  } 
  if ($devent == dclick) {
    if $did(1).seltext || $did(2).seltext || $did(3).seltext || $did(4).seltext {  
      did -ra $dname 21 $v1 | did -u $dname 1,2,3,4
    }
  }
}
dialog acro_color {
  title "-= (A)(M) =- Acro Color Settings"
  size -1 -1 226 90
  option dbu
  text "Select Acro colors :", 1, 41 6 50 8
  combo 2, 28 18 58 115, size drop
  combo 3, 28 49 58 103, drop
  text "Color 1 :", 4, 5 20 22 7
  text "Color 2 : ", 5, 5 51 21 7
  combo 6, 140 61 58 83, size drop
  text "BG Color :", 7, 113 63 24 7
  check "Enable BackGround Color", 8, 127 20 72 9
  text "(Can only be used when the Activate Sel Color option is enabled in the Options section.)", 9, 106 38 114 16
  button "Finished", 10, 92 78 35 9, ok
}
on *:dialog:acro_color:*:*:{
  if ($devent == init) {
    dll $scriptdirdll\colorcombo.dll COMBO acro_color 2 | did -c $dname 2
    dll $scriptdirdll\colorcombo.dll COMBO acro_color 3 | did -c $dname 3
    dll $scriptdirdll\colorcombo.dll COMBO acro_color 6 | did -c $dname 6
    if ($hget(amacroset,ama_backgroundset)) { did -c $dname 8 | did -e $dname 6 } | else { did -b $dname 6 }
  }
  if ($devent == sclick) {
    if ($did == 2) { if ($did($dname,$did).sel == 1) { return } | else { .hadd amacroset am_ac1 $calc($did($dname,$did).sel -2 ) } }
    if ($did == 3) { if ($did($dname,$did).sel == 1) { return } | else { .hadd amacroset am_ac2 $calc($did($dname,$did).sel -2 ) } }
    if ($did == 6) { if ($did($dname,$did).sel == 1) { return } | else { .hadd amacroset am_bgc $calc($did($dname,$did).sel -2 ) } }
    if ($did == 8) { .hadd amacroset ama_backgroundset $did(8).state }
    if ($did(8).state == 1) { did -e $dname 6 } | else { did -b $dname 6 }
  }
}
alias -l asciiwarno { dialog -m ascii_warn ascii_warn | .timerascii.warno 1 2 if ($dialog(ascii_warn)) { dialog -x ascii_warn } }
dialog ascii_warn {
  title "Warning!"
  size -1 -1 150 26
  option dbu
  text "You have not selected anything!!!", 1, 34 2 82 7
  button "Button", 2, 55 25 37 7, hide cancel
  text "( To select a character, just double click on what you want )", 3, 4 15 142 8
}
dialog options {
  title (A)(M) OPTIONS
  size -1 -1 97 119
  option dbu
  button "OK", 1, 70 4 13 8
  text "Disable (A)(M) Acros", 10, 18 4 50 7
  check "Activate Sel Colors", 2, 10 36 53 9
  check "Activate Rand Colors", 3, 10 46 61 9
  check "Activate Caps", 4, 10 26 43 9
  check "Make Acros Bold", 6, 11 64 54 10
  check "Underline Acros", 7, 11 76 50 10
  check "Reverse Acros", 8, 11 88 50 10
  check "Plain Acros", 5, 10 15 50 10
  button "Finished", 9, 28 104 37 12, ok
}
on *:dialog:options:*:*: {
  if ($devent == init) {
    if !$hget(amacroset) { .hmake amacroset 2 }
    if ($isfile($scriptdiramacroset.hsh)) { .hload amacroset $scriptdiramacroset.hsh }
    if ($hget(amacroset, am_Acroccaps)) { did -c $dname 2 }
    if ($hget(amacroset, am_Acrorcaps)) { did -c $dname 3 } 
    if ($hget(amacroset, am_Acrocaps)) { did -c $dname 4 }
    if ($hget(amacroset, ama_Bold)) { did -c $dname 6 }
    if ($hget(amacroset, ama_Underline)) { did -c $dname 7 }
    if ($hget(amacroset, ama_Reverse)) { did -c $dname 8 } 
    if ($hget(amacroset, am_Acroplain)) { did -c $dname 5 }
  } 
  if ($devent == sclick) {
    if ($did == 1) { 
      if $dialog(ascii_table) { dialog -x ascii_table } | if $dialog(acro_color) { dialog -x acro_color } 
      if $dialog(options) { dialog -x options } | if $dialog(acro_edit) { dialog -x acro_edit } 
      if $dialog(acro_main) { dialog -x acro_main }
      .hsave amacros $scriptdiramacros.hsh
      .hsave amacroset $scriptdiramacroset.hsh
      unset %acro_temp 
      $iif($group(#amacro) == on, .disable, .enable) #amacro
    }
    elseif ($did isnum 2-5) {
      if $did == 2 && $did(2).state { did -u $dname 3,4,5 }
      elseif $did == 3 && $did(3).state { did -u $dname 2,4,5 }
      elseif $did == 4 && $did(4).state { did -u $dname 2,3,5 }
      elseif $did == 5 && $did(5).state { did -u $dname 2,3,4 }
    }
    if ($did == 9) {
      .hadd  amacroset am_Acroplain $did(5).state 
      .hadd amacroset am_Acroccaps $did(2).state 
      .hadd amacroset am_Acrorcaps $did(3).state
      .hadd amacroset am_Acrocaps $did(4).state 
      .hadd amacroset ama_Bold $did(6).state 
      .hadd amacroset ama_Underline $did(7).state
      .hadd amacroset ama_Reverse $did(8).state
    } 
  }
}
dialog acro_edit {
  title (A)(M) Acro Editor
  size -1 -1 211 55
  option dbu
  edit , 1, 4 23 46 10
  edit "", 2, 55 23 150 10
  button "&Cancel", 5, 19 39 37 12, cancel
  button "&Edit Acronym", 6, 82 39 39 12
  text "-= Input Text =-", 7, 6 11 41 7
  text "-= Output Text =-", 8, 104 11 45 7
  button "Ascii &Table", 3, 146 39 37 12
}
on *:dialog:acro_edit:*:*: {
  if ($devent == init) {
    did -a $dname 1 $did(acro_main,3) | did -a $dname 2 $did(acro_main,4)
    did -r acro_main 3 | did -r acro_main 4 | did -h $dname 6
  }
  if ($devent == edit) {
    if $did(1).edited || $did(2).edited == $true {
      did -v $dname 6 
    }
  }
  if ($devent == sclick) {
    if ($did == 3) { dialog -m ascii_table ascii_table }
    if ($did == 6) {
      if %acro_temp { 
        if $hget(amacros) { 
          hdel amacros $did(acro_main,1,%acro_temp) | hadd amacros $did(1) $did(2) 
        } 
        did -o acro_main 1 %acro_temp $did(1) | did -o acro_main 2 %acro_temp $did(2) 
        did -r $dname 1,2 | did -b acro_main 5,6,25 | dialog -x acro_edit
        unset %acro_temp 
      } 
    } 
  }
}
dialog welcome {
  title " Welcome to -=(A)(M)=- Acros"
  size -1 -1 219 47
  option dbu
  text "-= (A)(M) =- Acros Script Has Been Successfully loaded!! =-", 1, 37 5 144 7
  text "To start using -=(A)(M)=- Acros Script, click anywhere on the Status or channel screens.", 2, 3 17 214 7
  button "Button", 3, 2 2 5 5, hide ok
  text "If you wish, you can access the script through the menubar as well.", 4, 19 24 163 7
  text "-=     Thanks For Choosing -= (A)(M) =- Acros Script.     =-", 5, 36 39 142 7
}
alias -l AmUnload {
  echo -a -= (A)(M) =- Acros Script Has Been Successfully Unloaded!!
  .unload -rs $scriptdiramacros.mrc
}
on *:exit:{
  .hsave amacros $scriptdiramacros.hsh | .hfree amacros
  .hsave amacroset $scriptdiramacroset.hsh | .hfree amacroset
}
on *:unload:{
  .hsave amacros $scriptdiramacros.hsh | .hfree amacros 
  .hsave amacroset $scriptdiramacroset.hsh | .hfree amacroset
  .unset %am_*
}
#amacro end
menu menubar,status,channel {
  -
  AmAcros System $chr(9) $iif($group(#amacro) == on, On, Off): $iif($group(#amacro) == on, .disable, .enable) #amacro
  .$iif($group(#amacro) == on,AmAcros)
  ..AmAcro Editor:dialog -m acro_main acro_main
  ..The Help File:/winhelp $scriptdirhelp\amacrohelp  
  ..Unload AmAcros:AmUnload
}