Trouble using "found image" in an if-then action

For several weeks, I've been using a macro to toggle voice control "Listening" on and off, because there appears to be no native keyboard shortcut for that.

I've been using a variable to track whether listening is currently on or off, but found my programming skills are not good enough to make it reliable. So today I'm trying to use a "found image" if-then action to be sure the variable matches the actual state of voice control listening. I've set KM to look for the blue voice control image at the right of the menu bar.

However, it seems I've created a couple of problems:

  1. My if-then says: if the screen contains the blue icon that indicates VC is listening, then set the VoiceControl variable to true, otherwise set it to false. Unfortunately, if KM doesn’t see the blue icon, instead of going to the "otherwise" action, it just aborts and says it couldn’t find the image. Is there a particular way I need to handle a "found image" in an if-then action?
  2. If I disable action #1 and just manually set the correct variable, my mouse click action puts the cursor at the right spot, but has stopped actually clicking that spot, even though my Move or Click Mouse action specifies "Click." It used to work before I started messing with things this morning.

I've been using the same macOS feature. Actually, there is a shortcut (if you enable it) that can turn this on and off. It is OPT-CMD-F5 as seen in the image below in the Accessibility Panel:

I haven't actually used this feature, but from what I read, it should work. That means you don't even need a macro. But let's answer the remainder of your questions anyway.

Since you didn't upload your macro, my comments are speculative...

If you are using the Find Image condition, instead of the Find Image action, then the only way it could abort (I think) is if you are using the condition "contains uniquely". If that's what you are using, switch to "contains" and it won't abort. I'm speculating here because I can't see your macro, but that could be the cause.

I can't understand this paragraph because I don't know what that means. Sorry.

OPT-CMD-F5 starts and stops Voice Control. I’m trying to toggle its start listening and stop listening control, which is only available in the menu bar.

For some reason, this morning it started finding the voice control icon in the menu bar. (I was using the screen "contains" and not "contains uniquely.")

In my second paragraph, I meant that in my "move or click mouse" action, the cursor was hovering , but not clicking, even though it was set to “click.” I fixed that by adding a .2 second pause after Bartender pulls down.

FYI, here's the macro.
Voice Control listening toggle.kmmacros (71.6 KB)

Regards,
Russell

I went to google and typed "what is macOS listening control" and it replied that it is "voice control." I also typed "listening" into the System Settings search box and found nothing appropriate. So can you tell me what you mean by "listening control"?

Or you could upload your macro so I could understand what you meant.

Sure. When voice control is running, you can speak, "stop listening" if you don't want it to pick up casual conversation or somebody speaking over the radio, etc. To resume the dictation, you say "Start listening."

You can also control this by clicking the voice control icon in the menu bar and selecting stop listening or start listening. I wanted to do this with an easy, single keystroke instead of saying the words or going to the menu every time. I've programmed this macro to trigger with a press of the "fn" AKA "globe" key. That key normally calls up the character viewer, I rarely use that and have given it a different shortcut in the keyboard settings.

P.S. I did upload the macro in the post I made this morning.

Best,
Russell

Oops. I'm very sorry. I make mistakes. If you want to fire me as a helper, I'll accept that.

Alright, we are talking about the dictation feature, shown here:

No, it's not "only available in the menu bar," it's also available by a keyboard shortcut shown in the dialog box above (which is Globe (x2) in the image above, but can be changed.) So technically, you don't need a KM macro to toggle dictation mode. But on order to turn on/off dictation mode with that shortcut, I think Voice Control must be off. Is that okay?

But if you really want to use a KM macro, I'm sure we can make it work. Are you sure you want to do it the hard way?

P.S. I don't have Bartender, but I don't think you need it to create a KM macro that will do this.

The initial action to simulate typing the keystroke adds the key to the keyboard event queue, but it mat be some time until the key is processed by the system, so if you are expecting to see the result of the keystroke on the screen, you would need to add a short pause after the Type Keystroke action to allow that to happen.

I tried using dictation, but in Obsidian (an Electron app), I found it frequently duplicates phrases, while voice control didn't. Go figure...

Peter is correct. I added the pause and it worked fine.