Word and Character Counter

By `Green on Dec 24, 2008

this is a dialog snippet made to count the character's of a line. its not very useful but i think i remember someone saying that they wanted a word counter. i don't know if i can make a word counter but i made a character counter :)

UPDATED

now has a word counter and a character counter. thank you typo :)

BUG

only counts the first line

dialog CC {
  title "Charactor Counter"
  size -1 -1 147 63
  option dbu
  edit "", 1, 1 24 145 38, multi return autovs
  button "Clear", 2, 1 1 72 11
  button "Close", 3, 77 1 69 11
  text "Words:", 4, 2 14 18 8
  edit "", 5, 20 13 46 10, read
  text "Caracters:", 6, 68 14 25 8
  edit "", 7, 93 13 52 10, read
}
on *:dialog:CC:*:*:{
  did -ra cc 5 $numtok($did(1),32)
  did -ra cc 7 $len($did(1))
  if ($devent == sclick) {
    if ($did == 2) did -r CC 1
    if ($did == 3) dialog -x cc cc
  }
}
menu * {
  .Charactor Counter: dialog -m CC CC
}

Comments

Sign in to comment.
`Green   -  Dec 25, 2008

oh and scakk. it stops at 4250 chars for me.

 Respond  
Typo   -  Dec 24, 2008

`Green said:

i don't know if i can make a word counter but i made a character counter :)
You can count words with:

$numtok(TEXT,32)

For instance, if you type the following in mirc:

//var %Words = How many words is this? | echo -a $qt(%Words) has $numtok(%Words,32) words.

You will see:

"How many words is this?" has 5 words.
Good luck.

 Respond  
guest598594   -  Dec 24, 2008
  if ($devent == sclick) {
    if ($did == 2) { did -r CC 1 }
  }
  if ($devent == sclick) {
    if ($did == 3) { dialog -x cc cc }
  }

You could combine the two if's

if ($devent == sclick) {
  if ($did == 2) did -r CC 1
  if ($did == 3) did -x cc cc
}
 Respond  
Scakk   -  Dec 24, 2008

It stops adding at 949 even though you can continue to add to the edit box.

 Respond  
^Neptune   -  Dec 24, 2008

Eh, it works I guess. You could expand it alot more by using a multi-line edit box for people to count essays, etc. Also, I think it would look cooler changing the length not on sclick, but on edit of the text box itself.

  did -ra cc 5 $len( $+ $did(1).text $+ )

Could just be

  did -ra cc 5 $len($did(1))

Don't see why you put the $+ in there :x.

 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.