利用pyautogui调用微信ocr

import pyautogui
import time

def ocrweixin(filename):
    # 鼠标点击,默认左键
    #移至sheet页
    pyautogui.click(1386,33) 
    #点击 地址框
    pyautogui.click(1364,94) 
    pyautogui.hotkey('ctrl','a')
    time.sleep(0.5)

    pyautogui.typewrite('file:///C:/Users/mydell/Desktop/zhuanxie/pic/'+str(filename)+'.png')
    # time.sleep(2)
    pyautogui.press('enter')
    time.sleep(2)

    pyautogui.click(784,638) 
    #启动微信ocr
    pyautogui.hotkey('alt', 'a')
    time.sleep(2)
    pyautogui.moveTo(668,132)


    # 鼠标选取范围
    pyautogui.mouseDown()   
    pyautogui.moveTo(1248,1073)
    # 鼠标释放
    pyautogui.mouseUp() 
    pyautogui.click(838,88) 

    time.sleep(1)
    pyautogui.click(1705, 551)
    pyautogui.hotkey('ctrl','a')
    pyautogui.hotkey('ctrl','c')

    # 获取剪贴板的内容
    clipboard_content = pyperclip.paste()
#     pyautogui.moveTo(1852,204)
    pyautogui.click(1852,204)
    return clipboard_content

posted on 2024-01-30 18:02  耀扬  阅读(224)  评论(0编辑  收藏  举报

导航