|
@@ -269,17 +269,20 @@ def dragAuto(gamestr, positions):
|
|
|
return True
|
|
|
|
|
|
def ocrAuto(gamestr, positions):
|
|
|
- tmpRet, tmpPos = find_window_pos(gamestr)
|
|
|
- if tmpRet == False:
|
|
|
- return []
|
|
|
-
|
|
|
- x1 = positions[0] + tmpPos[0]
|
|
|
- y1 = positions[1] + tmpPos[1]
|
|
|
- x2 = positions[2] + tmpPos[0]
|
|
|
- y2 = positions[3] + tmpPos[1]
|
|
|
- region = (x1, y1, x2, y2)
|
|
|
- lineStr = capture_and_ocr(region)
|
|
|
- print("识别到:", lineStr)
|
|
|
+ try:
|
|
|
+ tmpRet, tmpPos = find_window_pos(gamestr)
|
|
|
+ if tmpRet == False:
|
|
|
+ return []
|
|
|
+
|
|
|
+ x1 = positions[0] + tmpPos[0]
|
|
|
+ y1 = positions[1] + tmpPos[1]
|
|
|
+ x2 = positions[2] + tmpPos[0]
|
|
|
+ y2 = positions[3] + tmpPos[1]
|
|
|
+ region = (x1, y1, x2, y2)
|
|
|
+ lineStr = capture_and_ocr(region)
|
|
|
+ print("识别到:", lineStr)
|
|
|
+ except:
|
|
|
+ lineStr = ""
|
|
|
return lineStr
|
|
|
|
|
|
def yys_ocrAuto(positions):
|