zoukankan      html  css  js  c++  java
  • 借助有道词典识别屏幕字符串

    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)




  • 相关阅读:
    Centos-获取远程主机对应端口信息-telnet
    Centos-跟踪数据传输路由状态-traceroute
    Centos-本机网络连接、运行端口和路由表等信息-netstat
    Centos-远程拷贝-scp
    Centos-配置网络或显示当前网络接口状态-ifconfig
    Centos-挂载和卸载分区-mount
    Centos-退出抽取设备-eject
    Centos-强制将内存中数据写入磁盘-sync
    Centos-检查文件系统并尝试修复-fsck
    数据结构-静态查找表
  • 原文地址:https://www.cnblogs.com/rsapaper/p/8353566.html
Copyright © 2011-2022 走看看