Skip to main content

OP插件的Python接口

Project description

Welcome to pyopdll

项目简介

pyopdll是开源项目OP(operator & open)的Python接口, 内部封装了op_x64.dllop_x86.dll,支持32位和64位Python3

OP(operator & open)

  • Windows消息模拟,常见的键盘消息和鼠标消息模拟。
  • 支持常见的截图方式,gdi,dx(包括d3d9,d3d10,d3d11),opengl截图,支持常见模拟器(雷电,夜神)的最小化截图
  • 找色找图,支持偏色,支持模糊识别
  • 字符识别(OCR),最大支持255 X 255 超大点阵,支持偏色,支持模糊识别,支持系统字库,兼容大漠字库
  • 插件有32位和64位版本,支持32/64位绑定
  • 项目完全开源,无后门无病毒,可放心使用

项目地址

安装

pip install pyopdll

快速开始

import time
from pyopdll import OP

if __name__ == '__main__':

op = OP()

print(op.GetCursorPos())

# 打印注册路径
path = op.GetBasePath()
print(path)

# 打印坐标颜色
print(op.GetColor(2,2))

# 取消注册
# op.Un_reg()

# 运行本地程序
# op.RunApp(r"C:\Program Files (x86)\Xianghu\CCtalk\CCtalk.exe",0)


# 窗口句柄就是一个int类型的数字
# 获取鼠标指向的窗口句柄
hwnd = op.GetMousePointWindow()
print(hwnd)
# 打印窗口大小
print(op.GetClientSize(hwnd))
# 打印窗体标题栏
print(op.GetWindowTitle(hwnd))

# 获取在前台的窗口的句柄
print(op.GetForegroundWindow())

# 寻找记事本的句柄
# 标题需要严格一致才可找到
txt_hwnd=op.FindWindow("","新建文本文档.txt - 记事本")
print(txt_hwnd)
# 打印程序路径
print(op.GetWindowProcessPath(txt_hwnd))
# 最大化指定窗口,同时激活窗口.
print(op.SetWindowState(txt_hwnd,4))
# 使记事本窗口移动
op.MoveWindow(txt_hwnd, 10, 10)

# 拖拽
op.MoveTo(300,50)
op.LeftDown()
for i in range(100):
    time.sleep(0.01)
    op.MoveR(1,0)
op.LeftUp()

# 获取标题还有.py的所有句柄
# 注意:返回的是str,但句柄必须是int类型,要强行转化
hwnd_str_list=op.EnumWindow(0,".py","",1+2+4+8).split(",")
print(hwnd_str_list)
for hwnd in hwnd_str_list:
    print(op.GetWindowClass(int(hwnd)))
    print(op.GetWindowProcessPath(int(hwnd)))
    print(op.GetWindowTitle(int(hwnd)))
    # 全部移动
    # op.MoveWindow(int(hwnd),100,100)

# 推荐相对移动
op.MoveR(100, 100)

键盘代码

key_str 虚拟键码
"1", 49
"2", 50
"3", 51
"4", 52
"5", 53
"6", 54
"7", 55
"8", 56
"9", 57
"0", 48
"-", 189
"=", 187
"back", 8
"a", 65
"b", 66
"c", 67
"d", 68
"e", 69
"f", 70
"g", 71
"h", 72
"i", 73
"j", 74
"k", 75
"l", 76
"m", 77
"n", 78
"o", 79
"p", 80
"q", 81
"r", 82
"s", 83
"t", 84
"u", 85
"v", 86
"w", 87
"x", 88
"y", 89
"z", 90
"ctrl", 17
"alt", 18
"shift", 16
"win", 91
"space", 32
"cap", 20
"tab", 9
"~", 192
"esc", 27
"enter", 13
"up", 38
"down", 40
"left", 37
"right", 39
"option", 93
"print", 44
"delete", 46
"home", 36
"end", 35
"pgup", 33
"pgdn", 34
"f1", 112
"f2", 113
"f3", 114
"f4", 115
"f5", 116
"f6", 117
"f7", 118
"f8", 119
"f9", 120
"f10", 121
"f11", 122
"f12", 123
"[", 219
"]", 221
"\", 220
";", 186
"'", 222
",", 188
".", 190
"/", 191

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyopdll-0.0.1.tar.gz (19.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyopdll-0.0.1-py3-none-any.whl (947.9 kB view details)

Uploaded Python 3

File details

Details for the file pyopdll-0.0.1.tar.gz.

File metadata

  • Download URL: pyopdll-0.0.1.tar.gz
  • Upload date:
  • Size: 19.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for pyopdll-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e31186d4a29d6cf54a1aec1ab6e52add34bf84fe971bdb63e7b98971463f7d2e
MD5 485f5111fae988728fe8513a430c6240
BLAKE2b-256 400e3e4021566de53ec2bb05f8a977ee52b6121fd6259a481e9dc1fa7ff15e66

See more details on using hashes here.

File details

Details for the file pyopdll-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: pyopdll-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 947.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

File hashes

Hashes for pyopdll-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dbe62e124b780576fc3937ddcd070f5e29c407cc14b6bdfae85ff63891c8cdde
MD5 878ec673524bbf667d046efb54db3ee3
BLAKE2b-256 16f084f036bcf3dbc1effef44c7b413c8ab767ec77e857007589c360af39058f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page