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
  • Thanks !

    I ran into a problem with the script that I don't know how to solve. Maybe an IF no text is selected, then return, or IF no text selected, show 0 character?

    I have no problem running the script on selected text, but if I press the hotkeys without first selecting text, nothing happens, and the script no longer works.

    This script would be super useful to my team when translating social media content, but some of my translator are not that comfortable with computers, and I definitely anticipate one of them forgetting to select the text, and they would’nt know how to restart the script.

    Any idea how to work around this error?

Reply
  • Thanks !

    I ran into a problem with the script that I don't know how to solve. Maybe an IF no text is selected, then return, or IF no text selected, show 0 character?

    I have no problem running the script on selected text, but if I press the hotkeys without first selecting text, nothing happens, and the script no longer works.

    This script would be super useful to my team when translating social media content, but some of my translator are not that comfortable with computers, and I definitely anticipate one of them forgetting to select the text, and they would’nt know how to restart the script.

    Any idea how to work around this error?

Children