Another simple macro. This one is for anyone who needs to count characters (e.g. for a tweet or headline) and/or words (e.g. for writers and copywriters). It displays an alert showing the character and word count in the highlighted text when you press Control+C.
This sounds very cool but for some reason for me it is not working in Big Sur and Keyboard Maestro 9.2
Update: I figured out that I had notifications for Keyboard Maestro turned off which is strange because they have always shown in the past. It works now with Display Text Briefly. I needed it turned on for Keyboard Maestro Engine and not Keyboard Maestro in notifications center.
Assuming the Group the macro is in is enabled -- do you actually have copyable text selected when you run the macro? If not, the first action will fail (although you won't be notified for 10 seconds, when the action's timeout has been exceeded).
With that macro you don't copy to the clipboard -- the macro does a Copy action and puts whatever is selected onto a named clipboard, the contents of which are then put into a variable, which is then word-counted.
Select some text, then run the macro while keeping the window with the selected text frontmost.
I realise "Well, it works here" doesn't help much, but... It works here.
But the macro doesn't match the description of what you are doing. Describe what you are trying to achieve and let's see if a rewrite solves the problem.
@Nige_S I want to be able to select some text and get the word count. I was trying to see where this might be failing so I created a Macro with just one action, Display Text. I cannot get it to display anything.
Make sure the macro is enabled and its parent macro group is enabled.
Change the hotkey to F1 and try again.
If it still does nothing then run the Interactive Help from the Keyboard Maestro Editor Help Menu.
Always make certain the macro you're building actually functions in the context it's supposed to before adding complexity.
I have the Iconaholic Loud status menu icons installed on my system, so I always know when KM fires a macro.
I never use named clipboards, unless I have a really legitimate reason to do so. All copied and pasted text goes through the system clipboard, so it's better to restrict transitory usage to it and use variables for other manipulation.
I only use named clipboards for longterm storage/reuse of formatted items such as style-text, images, KM Actions, etcetera.
Everything looks good and even when I simply click Run, it does not work. Interactive Help checked off everything. It would seem to be (of all things) the Display Text action which does not do anyting even when it is the only Action in a macro.
@ihf Please try the tests I prescribed and those @ccstone mentioned.
Also, when you're talking about macros, programming, or software in general, please be very specific about what you're doing and the actual result of your actions. "It does not work" is not very helpful and doesn't tell us what you did. We also still have no idea in what application or context you're trying to count words. Is it Microsoft Word? Gmail? BBEdit? Star Wars the Old Republic?
Can you try writing it in a step-by-step like the below?
I select a paragraph of text in TextEdit
I press Control-C and a window appears with the word and character count of the selected text
I close the window
I change the keyboard shortcut in KM to Option-N
I select a paragraph of text in TextEdit
I press Option-N and the window with word and character counts does not appear
So you have a macro whose only action is Display Text. What's in the main area of the Display Text action? Is a variable? If so, replace the variable with the text "Hello, world!" and run the macro. (I'm assuming the macro group is active, it's not limited to a specific application, etc. etc.)