简体   繁体   中英

Monitor value via OCR

Background: Sometime I have the need to monitor the change of a value in a certain program. My solution is to use a batch file to capture the part of the screen with where the value is shown with Minicap and then use Tesseract to convert the value to plain text. However this script would not work so good if I would need to monitor value change every second for several hours.

Current solution (simplified example):

minicap.exe -captureregion 800 600 850 620 -save C:\file.png -exit -escapequit
tesseract.exe C:\file.png out.txt

Question: What I would like is some simple way to OCR a value directly from the screen to use in the batch file, perhaps buffer several values before appending them to a csv file. I would prefer to do this without the need to install python or write compiled software

(Posted on behalf of the question author, to move the solution to the answer space) .

I found that I could use Capture2Text. The following command takes the on screen text and prints it to stdout:

Capture2Text_CLI.exe --screen-rect "800 600 850 620"

This way it's possible to run the command, check if the value is changed, and if so, append it to a log file together with a timestamp.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM