How to count the words in copied text with a hotkey
Create a KeyRoutines routine with a Hotkey trigger, Get clipboard for text, Replace text to turn line breaks into spaces, Split text at spaces, Count list items, and Show banner with the count.
Steps
- 1
Add a Hotkey trigger
Pick a chord such as Ctrl+Alt+W.
- 2
Read the copied text
Add Get clipboard set to text.
- 3
Tidy the spacing
Add Replace text with the pattern option on, finding \s+ and replacing it with one space.
- 4
Split and count
Add Split text at a space, then Count list items on its parts.
- 5
Show it
Add Show banner with the count and "words".
Tips
- Split text drops empty parts by default, so double spaces don't add words.
- Add a Calculate step dividing the count by 150 for a rough speaking time for a video script.
Questions
- Does it count characters too?
- Split text into characters and count those for a character count.
- Is my text stored anywhere?
- No. Run history shows only the length of clipboard text, never the words.