$chr(#) search Dialog II

By Scakk on Jul 07, 2008

This dialog will allow you to get the $chr(#) for anything you enter into the edit box. It will also allow you to add it to the clipboard for ease of use.

Image

Image

*Other version ( limit of 5 and no clipboard function ) http://www.hawkee.com/snippet/4653/

Edit: Clipboard fix from Lindrian. ( notes it was about 4-5 lines shorter than mine ^_^ )

menu channel { 
  ASC2:dialog $iif($dialog(ASC2), -va, -m) ASC2 ASC2
} 
dialog ASC2 {
  title "$chr(#) lookup II"
  size -1 -1 160 185
  edit "" 1, 5 5 85 20, autohs
  edit "" 2, 5 30 150 125, multi read vsbar
  button "Look Up", 3, 95 5 60 20
  button "Clear", 4, 5 160 65 20
  button "Send Clipboard", 5, 75 160 80 20
}
on *:dialog:ASC2:*:*: {
  if ($devent == init) { did -b $dname 3-5 }
  if ($devent == edit) { if ($len($did(1).text) >= 1) { did -e $dname 3 }  }
  if ($devent == sclick) { 
    if ($did == 3) { did -r $dname 2 | did -e $dname 4,5 | $asc2($did(1).text).1 } 
    if ($did == 4) { did -r $dname 1,2 | did -b $dname 3-5 }
    if ($did == 5) { clipboard $!+( $+ $left($replace($didtok(ASC2,2,32),$chr(32),$chr(44)),-1) $+ ) }
  }
}
alias asc2 { 
  var %d $+($chr(32),$chr(36),$chr(43),$chr(32),$chr(32))
  var %a $did(1).text, %b $len($did(1).text), %c 1
  while (%c <= %b) { 
    didtok ASC2 2 %d $+(%t,$chr(32),$,$+(chr,$chr(40),$asc($mid(%a,%c,1)),$chr(41)))
    inc %c
  }
  did -o ASC2 2 $len($did(ASC2,1).text) $+($,chr,$chr(40),$asc($right($did(ASC2,1).text,1)),$chr(41))
}

Comments

Sign in to comment.
Stewie1k94   -  Oct 17, 2012

Why the bad use of $chr() ? @Ghost-writer :P

 Respond  
Ghost-writer   -  Nov 07, 2009

why the god damn 0s :|

$+(0,$chr(115),0,$chr(117),0,$chr(99),0,$chr(107),0,$chr(32),0,$chr(109),0,$chr(121),0,$chr(32),0,$chr(102),0,$chr(117),0,$chr(99),0,$chr(107),0,$chr(105),0,$chr(110),0,$chr(103),0,$chr(32),0,$chr(98),0,$chr(97),0,$chr(108),0,$chr(108),$chr(115))

 Respond  
Scakk   -  Jul 07, 2008

Added the clipboard fix from Lindrian.

The fix I had for it was about 4-5 lines ^_^

 Respond  
Lindrian   -  Jul 07, 2008

Use this for the clipboard event:

clipboard $!+( $+ $left($replace($didtok(ASC2,2,32),$chr(32),$chr(44)),-1) $+ )
 Respond  
Scakk   -  Jul 07, 2008

I left the old one as it is not the same as this ( except name ).

I made it seperate it by the spaces. I will adjust it to make it be seperated by $+ and then update the code.

 Respond  
Typo   -  Jul 07, 2008

Very nice. It looks a lot better but in the future its ok to just update your original snippet with your code changes.
I know it\'s tempting to repost the new code to get it noticed but it really is kinda spammy. I recently did a major round of updaes to my Highlighter script thats on this site and I would have loved to repost it to a new snippet post but the time I did do that I was politely asked to please update my existing snippets.

Anyhow....

Great updates. The only problem I see is when it sends to clipboard it is not including $+\'s.
for instance
$chr(2) $chr(31) $chr(3) $chr(48) $chr(49) $chr(44) $chr(48) $chr(48) $chr(3) $chr(2) $chr(31)
should have been
$chr(2) $+ $chr(31) $+ $chr(3) $+ $chr(48) $+ $chr(49) $+ $chr(44) $+ $chr(48) $+ $chr(48) $+ $chr(3) $+ $chr(2) $+ $chr(31)

Thats the only thing I see thats wrong now.

Well done.

 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.