文字识别
#-*-Python-*-
# Created by [哥的迷思](https://www.jianshu.com/u/e3dc5c8207e8)
#
import os
#import array
import datetime
import pyautogui
import configparser
import pyperclip
import time
import random
# 创建对象
def get_word():
# 获取区域内文字
a=1
b=1
print(pyautogui.size())
pyautogui.click(X1*a,Y1*b)
time.sleep(1)
pyautogui.click(1876*a,994*b) #点击ABBYY screenshot reader的弹窗
time.sleep(1)
pyautogui.click(1876*a,994*b) #点击ABBYY screenshot reader
#pyautogui.hotkey('alt','enter') # ABBYY screenshot reader 快捷键
pyautogui.moveTo(X2*a,Y2*b,duration=1)
pyautogui.dragTo(X3*a,Y3*b,duration=1)
pyautogui.hotkey('enter')
time.sleep(5)
pyautogui.click(X4*a,Y4*b)
pyautogui.hotkey('ctrl','v')
pyautogui.hotkey('enter')
pyautogui.hotkey('ctrl','s')
pyautogui.click(X0*a,Y0*b)
time.sleep(1)
def get_word1():
# 获取区域内文字
a=1
b=1
print(pyautogui.size())
pyautogui.click(X1*a,Y1*b)
time.sleep(1)
pyautogui.click(X0*a,Y0*b)
time.sleep(1)
def data_read():
setdata = configparser.ConfigParser() # 类实例化
path = 'set.ini'
setdata.read(path)
return setdata
if True:
setdata = data_read()
X=setdata['loc']['X'].split(',')
Y=setdata['loc']['Y'].split(',')
##########################################################################
#对应的X坐标
X0= int(X[0]) # 下一题按钮位置
X1= int(X[1]) # 查看答案按钮位置
X2= int(X[2]) # 页面左上位置
X3= int(X[3]) # 页面右下位置
X4= int(X[4]) # 文本框光标位置
#对应的Y坐标
Y0= int(Y[0])
Y1= int(Y[1])
Y2= int(Y[2])
Y3= int(Y[3])
Y4= int(Y[4])
n=0
j=0
i=0
for i in range(3000):
get_word()
set.ini
[loc]
X=147, 1069, 18, 1132, 1324
Y=794, 794,147, 737, 703