Ascii set

By eXiled on Oct 12, 2007

This snippet goes two ways. You can type /ascii win to create a new window with the characters, or /ascii dial to create a dialog with the characters. Your choice to what you think is easier. Please note this does NOT cover characters below 32. I might update it later though. Thanks in advance for any advice or feedback.

; ascii set (window or dialog)
; eXiled
; /ascii win
; /ascii dial 

dialog asc {
  title "Ascii dialog"
  size -1 -1 168 34
  option dbu
  list 1, 1 5 83 26, size
  box "", 2, 87 2 75 29
  text "Character:", 3, 89 10 28 8
  text "", 4, 119 10 28 8
  text "Asc value: ", 5, 89 19 29 9
  text "", 6, 119 19 28 9
  button "!", 7, 148 9 11 9
  button "!", 8, 148 19 11 8
}

on *:dialog:asc:init:0:ascload dialog
on *:dialog:asc:sclick:*:{ 
  if ($did = 7) clipboard $did($dname,4).text
  if ($did = 8) clipboard $did($dname,1).seltext
  if ($did = 1) { 
    did -ra $dname 4 $asc($did($dname,1).seltext)
    did -ra $dname 6 $did($dname,1).seltext
  }
}
alias ascii { 
  if ($1) { 
    if ($v1 = win) { 
      if ($window(ascii)) window -c @ascii
      window -lk @ascii
      ascload window
    }
    if ($v1 = dial) { 
      dialog $iif($dialog(asc),-v asc asc, -m asc asc)
    }
  }
}

alias -l ascload { 
  if ($1) { 
    if ($v1 = dialog) { 
      if ($dialog(asc)) { 
        var %x 32
        while (%x <= 255) {
          did -a asc 1 $chr(%x) 
          inc %x
        }
      }
    } 
    if ($v1 = window) { 
      var %x 32 
      while (%x <= 255) {
        aline -p @ascii Character $chr(%x) 
        inc %x
      }
    }
  }
}

menu @ascii { 
  dclick:clipboard $gettok($sline($active, 1),2,32)
  Copy Character:clipboard $gettok($sline($active, 1),2,32)
  Copy Ascii Number:clipboard $asc($gettok($sline($active, 1),2,32))
}

Comments

Sign in to comment.
eXiled   -  Oct 14, 2007

Odd, if you can\'t tell me the error I can\'t fix it. It is actually much better for people to tell me errors so I can learn from my mistake and try not to give out that error again. So please, if you have any errors, post them here and it will help me learn. ;p Thanks Tippy.

 Respond  
Tippy   -  Oct 14, 2007

Your good you need to work on it though I see a few errors but I\'m not gonna tell you because If I did you wouldn\'t learn anything :) Keep it up.

Regards,

Tippy

 Respond  
eXiled   -  Oct 13, 2007

comments, suggestions?

 Respond  
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.