• 借助有道词典识别屏幕字符串


    import win32api
    import time
    import win32clipboard
    import win32con

    # 捕获模拟器窗口 160-56 仅可单击打
    # 遍历url连接 -移动 126-766
    # 有道-更多释义-鼠标左单击 411-813
    # 有道查询口-鼠标左双击 959-270
    # 有道查询口-鼠标右单击 959-270
    # 有道查询口-鼠标左单击-剪切 1065-313
    time.sleep(12)
    x, y = 160, 56
    win32api.SetCursorPos([x, y])
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y)
    time.sleep(0.05)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y)
    time.sleep(10)

    x, y = 126, 766
    win32api.SetCursorPos([x, y])
    time.sleep(10)

    x, y = 411, 813
    win32api.SetCursorPos([x, y])
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y)
    time.sleep(0.05)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y)
    time.sleep(10)

    x, y = 959, 270
    win32api.SetCursorPos([x, y])
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y)
    time.sleep(0.05)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y)
    time.sleep(0.05)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y)
    time.sleep(0.05)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y)
    time.sleep(2)

    time.sleep(1)
    win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTDOWN, x, y)
    time.sleep(0.05)
    win32api.mouse_event(win32con.MOUSEEVENTF_RIGHTUP, x, y)
    time.sleep(2)

    win32clipboard.OpenClipboard()
    # win32clipboard.EmptyClipboard()
    time.sleep(0.2)
    x, y = 1065, 313
    win32api.SetCursorPos([x, y])
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y)
    time.sleep(0.05)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y)
    time.sleep(2)

    # 之前,必须设置鼠标右键后关闭win输入法
    cs = win32clipboard.GetClipboardData(win32con.CF_UNICODETEXT)

    x, y = 126, 766
    win32api.SetCursorPos([x, y])
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTDOWN, x, y)
    time.sleep(0.05)
    win32api.mouse_event(win32con.MOUSEEVENTF_LEFTUP, x, y)
    time.sleep(10)




  • 相关阅读:
    WCF上传下载文件
    WCF使用相关
    .net WCF WF4.5 状态机、书签与持久化
    .net WCF WF4.5
    CSS小东西
    asp.net mvc导出execl_转载
    winform自定义控件开发
    html问题汇总
    工作中的小东西
    jQuery事件
  • 原文地址:https://www.cnblogs.com/rsapaper/p/8353566.html
Copyright © 2020-2023  润新知