A complex (OCR issue)

Asked by xyz_User on 2020-04-28

Please advise if this is possible. With my current script I'm using the exec command to read external py file (with values or function) then executing that function from within sikuli.

My quesion is: How can i go about reading the ORC text on an image (This part is working fine, reads correct text) THEN compare that to the external py file value.

So for eg: my ext py file (limit.py) has the following declaration:

limit = 1000

Sikuli now reads a number on an image via OCR (say 2000)

now I need to execute the following:

if read image (2000) is > 1000 (in the limit.py) file do x

I hope that made sense. Please advise --- The part regarding reading external file is a must otherwise this would be easy to implement. Thank you!

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2020-04-28
Last reply:
2020-04-28

This question was reopened

RaiMan (raimund-hocke) said : #1

Have a look on how to read the lines contained in a file

pyFile = open(...)
for line in pyFile:
    if line.strip().startsWith("limit ="):
        # eval the line

Can you help with this problem?

Provide an answer of your own, or ask xyz_User for more information if necessary.

To post a message you must log in.