Ascii Script

By DoruMolnar on Mar 13, 2016


on *:Load: { window @ASCII | echo @ASCII 5Ascii generator by DoruMolnar loaded. To use it, click ASCII - Generate in the channel menu. | .timeras 1 3 window -c @ASCII }
dialog ascii {
  title ASCII
  option dbu
  size -1 -1 40 170
  list 1, 0 0 40 130
  button "Default", 2, 0 130 40 8
  button "From 1 to ...", 3, 0 138 40 8
  button "Copy to clipboard", 5, 0 146 40 16, style multi
  button "Done", 4, 0 162 40 8, ok
}
dialog showascii {
  title Show ascii code
  option dbu
  size -1 -1 80 50
  box "Enter symbol:", 1, 5 5 70 25
  edit "", 2, 10 15 8 10
  text "ASCII", 3, 20 17 20 10
  edit "", 4, 37 15 33 10, style read
  button "Done", 5, 10 35 60 10
}

on *:dialog:ascii:sclick:2: {
  .did -r ascii 1
  set %i 1
  while %i <= 256 { .did -a ascii 1 %i ---> $chr(%i) | inc %i }
  unset %i
}
on *:dialog:ascii:sclick:3: {
  set %i 1
  set %max $?="Enter max number:"
  if %max isnum {
    .did -r ascii 1
    while %i <= %max { .did -a ascii 1 %i ---> $chr(%i) | inc %i }
  }
  unset %i 
  unset %max
}
on *:dialog:ascii:sclick:5:/clipboard $chr( $+ $did(1).sel $+ )
on *:dialog:showascii:edit:2: { 
  .did -r showascii 4
  .did -a showascii 4 $asc($did(2)) (for $did(2) $+ )
  .did -r showascii 2
}
on *:dialog:showascii:sclick:5: .dialog -x showascii

menu channel {
  -
  Scripter tools
  .ASCII
  ..ASCII list
  ...Generate: { .dialog -m ascii ascii | ascdef }
  ...-
  ...Remove: { 
    set %acc $?!="Are you sure you want to completely remove the Asscii generator add-on?" 
    If %acc == $true { window @ASCII | echo @ASCII 5Unloading ASCII generator... | .timerua 1 1 { echo @ASCII 5ASCII generator successfully removed. Thank you for using my script! (Lestat^) | .timeras 1 3 window -c @ASCII } | .unload -rs ascii.mrc }
  }
  ..Get ascii code:.dialog -m showascii showascii
  -
}

alias ascdef {
  set %i 1
  while %i <= 256 { .did -a ascii 1 %i ---> $chr(%i) | inc %i }
  unset %i
}

Comments

Sign in to comment.
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.