I'm trying to make the macro detect when a number stops changing on the screen. Currently, the macro executes a process that involves an interface changing repeatedly. I have an error handling system, and if it fails, and the system I'm creating now is a backup if the error system also fails.
The screenshots below show that I have two variables measuring the same OCR. This is to allow me to change the time value of "LastChangeTime" on separate instances (because I want to measure a stoppage).
I want to trigger an action if the OCR detects a stoppage for x amount of time (in the number it is monitoring).
Haven’t been able to get an answer for this yet unfortunately.
Here are the screenshots of my current setup:
This is quite abstract and esoteric, so it might help if you posted a screen recording of the number changing, so that other forum users can experiment and test their suggestions.
There is a clip of the XP bar
Please make another screen recording, like this:
- Cropped a bit less closely (i.e. show slightly more of the screen).
- Make sure the recording includes a moment when the number stops changing, as this is what you're testing for.
- If it's a gif, drag it directly into the comment box; no need to host on another site. If it's a video, then depending on the size, you can either zip it and post here or host externally like the last clip.
I would love to help, and I have lots of ideas to help, but I need to see more information. I need to see a video of the data you are trying to analyze. (The video link you provided above is unavailable now.) And I also need you to indicate the range of possible numeric values, and whether there will always be a valid numeric value. I also want to know how quickly you want the routine to operate (ie, acceptable latency.) I also want to know if you understand that the word "trigger" is erroneous here, because this must be accomplished by "polling." I'm also curious why you are using KM's OCR instead of the macOS OCR.
However I will suggest right now, based on the limited information I have, that using OCR is the wrong approach. "Detecting a change to a part of the screen" can be done much more quickly using the Find Image actions that KM has. It will be much faster and simpler to code.
EDIT: KM 11 just arrived 15 minutes ago. I'm testing it now. The new support for Apple Text Recognition means that, according to my initial tests, OCR is now three times faster. I've been using Apple's OCR for years now, and it's extremely reliable. Nothing is 100%, but it can read words that I myself cannot read. It's that good.