Counting characters in a segment

I came across this script from Selcuk Akyuz in the Proz website a few weeks ago:

;------------------------------------------------------------------------------
; Count characters in a segment
;------------------------------------------------------------------------------
!c::
Send, ^c
ClipWait
Chars := StrLen(Clipboard)
RegExReplace(Clipboard,A_Space,"",Spaces)
MsgBox % "The highlighted text is " Chars " characters in length and contains " Spaces " spaces."
clipboard = ; Empty the clipboard
return

The way it works is you select some text in the source or target segment and press Alt+c.  You then get something like this with a small message box that contains the count including spaces:

Paul Filkin | RWS Group

________________________
Design your own training!

You've done the courses and still need to go a little further, or still not clear? 
Tell us what you need in our Community Solutions Hub

Parents
  • Hi Paul,

    I have a problem with this script. I think it needs some way to reset it, although I have no idea how. If I select a three-character word after having run the script, say, for a 10-character selection, the message box says the new selection, which I plainly see has only 3 characters, has 10 characters, in other words, the previous result seems to remain in the clipboard and is output again after a new selection and new press of the hotkey.

Reply
  • Hi Paul,

    I have a problem with this script. I think it needs some way to reset it, although I have no idea how. If I select a three-character word after having run the script, say, for a 10-character selection, the message box says the new selection, which I plainly see has only 3 characters, has 10 characters, in other words, the previous result seems to remain in the clipboard and is output again after a new selection and new press of the hotkey.

Children