WallBreaker2 / op

Windows消息模拟,gdi,dx,opengl截图,找图,找字(OCR)
MIT License
424 stars 160 forks source link

AHK怎么调用op插件 #29

Closed hentai87 closed 1 year ago

ycrao commented 3 years ago
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
#SingleInstance

;请自行在 cmd/powershell 管理员身份下执行注册与反注册操作
;RunWait, regsvr32 /s op_x86.dll
;RunWait, regsvr32 /u op_x86.dll

op := ComObjCreate("op.opsoft")
ver := op.Ver()
MsgBox %ver%

;RunWait, notepad.exe
Sleep, 1000
;主窗口
hwnd := op.FindWindowByProcess("notepad.exe", "", "记事本")
;编辑窗口
childHwnd := op.FindWindowEx(hwnd, "Edit", "")
;绑定窗口
ret := op.BindWindow(hwnd, "gdi", "normal", "windows", 0)
;设置窗口大小
ret2 := op.SetClientSize(hwnd, 1200, 640)
;向编辑窗口发送字符串
ret3 := op.SendString(childHwnd, "i come to test!")
MsgBox, %ret3%