Get Character & Word Count Macro

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.

@Nige_S Thanks but that still produces no result.

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.

@ihf My original macro doesn't work for you? Have you downloaded it and tried it?

I just verified in this post that it still works on my computer (it's 310 characters and 61 words, by the way).

Does your macro work if you use the Run Macro button in KM?

If yes, the problem might be your shortcut of Opt+N.

That's correct, it does not work. I can't get Display Text to show anything

Your macro works for me right out of the box...

  • 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?

  1. I select a paragraph of text in TextEdit
  2. I press Control-C and a window appears with the word and character count of the selected text
  3. I close the window
  4. I change the keyboard shortcut in KM to Option-N
  5. I select a paragraph of text in TextEdit
  6. 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.)

Is it enabled?

Post the macro, so we can see.

It turns out to be Display Text Briefly is not showing anything but if I change that action to Display Text in a Window, it works fine.

1 Like

It'll do that if your computer is set to Do Not Disturb

1 Like

Computer is not set to Do Not Disturb but Display Text Briefly does nothing.

Replace but (in your sentence) with therefore

( as @iampariah explains, Do Not Disturb switches off brief notifications, but allows KM display text in window actions )

Is the same true for all KM "Display Text Briefly"s? Have you allowed Notifications from KM? Check System Settings->Notifications->Application Notifications and make sure that both KM and KM Engine are allowed and set to at least show Banners.

Yes, Display Text Briefly does not work at all. Notifications were indeed off; however, turning them on has has the desired effect.

Correction KM Engine was also off, with both on, it works as expected. Thanks very much for your help!


@ComplexPoint In the interests of keeping the forums friendly, especially to people for whom English is not their first or primary language, maybe we should focus less on correcting grammar when the point comes across just fine with colloquial language.


Not remotely interested in grammar :slight_smile:

My point was that switching on Do No Disturb disables (rather than enabling) notifications.

( perhaps a misunderstanding )

1 Like