├── .gitignore ├── LINCENSE ├── pydmsoft ├── __init__.py └── dm.py ├── readme.md └── setup.py /.gitignore: -------------------------------------------------------------------------------- 1 | dist/* 2 | build/* 3 | pydmsoft.egg-info/* 4 | -------------------------------------------------------------------------------- /LINCENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) [year] [fullname] 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /pydmsoft/__init__.py: -------------------------------------------------------------------------------- 1 | from pydmsoft.dm import TimeOutException 2 | from pydmsoft.dm import DM -------------------------------------------------------------------------------- /pydmsoft/dm.py: -------------------------------------------------------------------------------- 1 | import ctypes 2 | import os 3 | from comtypes.client import CreateObject 4 | import win32com.client 5 | import time 6 | 7 | class TimeOutException(Exception): 8 | pass 9 | class WapperDM: 10 | def __init__(self, result, method, failure_indicators, *args, **kwargs): 11 | self.method = method 12 | self.args = args 13 | self.kwargs = kwargs 14 | self.initial_result = result 15 | self.failure_indicators = failure_indicators 16 | 17 | def is_failure(self, result): 18 | if isinstance(result, tuple) and result[0] == self.failure_indicators: 19 | return True 20 | if isinstance(result, str): 21 | return self.failure_indicators in result 22 | return False 23 | 24 | def wait_until(self, duration, interval=1): 25 | end_time = time.time() + duration 26 | while time.time() < end_time: 27 | response = self.method(*self.args, **self.kwargs) 28 | if not self.is_failure(response): 29 | return response 30 | time.sleep(interval) 31 | raise TimeOutException("等待超時") 32 | 33 | def __repr__(self): 34 | return repr(self.initial_result) 35 | 36 | def wapper_decorator(failure_indicators): 37 | def decorator(method): 38 | def wapper(*args, **kwargs): 39 | result = method(*args, **kwargs) 40 | return WapperDM(result, method, failure_indicators, *args, **kwargs) 41 | return wapper 42 | return decorator 43 | 44 | 45 | class DM(): 46 | def __init__(self,DmRegPath=None,DMPath=None) -> None: 47 | self.dm = None 48 | if DmRegPath is None and DMPath is None: 49 | print("不使用免註冊") 50 | self.dm = win32com.client.Dispatch('dm.dmsoft') 51 | elif DmRegPath is not None and DMPath is not None: 52 | print("使用免註冊調用") 53 | self.dm = self.免註冊調用(DmRegPath,DMPath) 54 | 55 | else: 56 | raise Exception("請傳入兩個參數或者不傳入參數") 57 | if not self.dm: 58 | raise Exception("DM初始化失敗") 59 | 60 | 61 | def 免註冊調用(self,DmRegPath,DMPath): 62 | try: 63 | dm = win32com.client.Dispatch('dm.dmsoft') 64 | except: 65 | dms = ctypes.windll.LoadLibrary(DmRegPath) 66 | location_dmreg = DMPath 67 | dms.SetDllPathW(location_dmreg, 0) 68 | dm = CreateObject('dm.dmsoft') 69 | return dm 70 | def SetPath(self, path): 71 | return self.dm.SetPath(path) 72 | 73 | def Ocr(self, x1, y1, x2, y2, color, sim): 74 | return self.dm.Ocr(x1, y1, x2, y2, color, sim) 75 | 76 | def FindStr(self, x1, y1, x2, y2, str, color, sim): 77 | return self.dm.FindStr(x1, y1, x2, y2, str, color, sim) 78 | 79 | def GetResultCount(self, str): 80 | return self.dm.GetResultCount(str) 81 | 82 | def GetResultPos(self, str, index): 83 | return self.dm.GetResultPos(str, index) 84 | 85 | def StrStr(self, s, str): 86 | return self.dm.StrStr(s, str) 87 | 88 | def SendCommand(self, cmd): 89 | return self.dm.SendCommand(cmd) 90 | 91 | def UseDict(self, index): 92 | return self.dm.UseDict(index) 93 | 94 | def GetBasePath(self): 95 | return self.dm.GetBasePath() 96 | 97 | def SetDictPwd(self, pwd): 98 | return self.dm.SetDictPwd(pwd) 99 | 100 | def OcrInFile(self, x1, y1, x2, y2, pic_name, color, sim): 101 | return self.dm.OcrInFile(x1, y1, x2, y2, pic_name, color, sim) 102 | 103 | def Capture(self, x1, y1, x2, y2, file): 104 | return self.dm.Capture(x1, y1, x2, y2, file) 105 | 106 | def KeyPress(self, vk): 107 | return self.dm.KeyPress(vk) 108 | 109 | def KeyDown(self, vk): 110 | return self.dm.KeyDown(vk) 111 | 112 | def KeyUp(self, vk): 113 | return self.dm.KeyUp(vk) 114 | 115 | def LeftClick(self): 116 | return self.dm.LeftClick() 117 | 118 | def RightClick(self): 119 | return self.dm.RightClick() 120 | 121 | def MiddleClick(self): 122 | return self.dm.MiddleClick() 123 | 124 | def LeftDoubleClick(self): 125 | return self.dm.LeftDoubleClick() 126 | 127 | def LeftDown(self): 128 | return self.dm.LeftDown() 129 | 130 | def LeftUp(self): 131 | return self.dm.LeftUp() 132 | 133 | def RightDown(self): 134 | return self.dm.RightDown() 135 | 136 | def RightUp(self): 137 | return self.dm.RightUp() 138 | 139 | def MoveTo(self, x, y): 140 | return self.dm.MoveTo(x, y) 141 | 142 | def MoveR(self, rx, ry): 143 | return self.dm.MoveR(rx, ry) 144 | 145 | def GetColor(self, x, y): 146 | return self.dm.GetColor(x, y) 147 | 148 | def GetColorBGR(self, x, y): 149 | return self.dm.GetColorBGR(x, y) 150 | 151 | def RGB2BGR(self, rgb_color): 152 | return self.dm.RGB2BGR(rgb_color) 153 | 154 | def BGR2RGB(self, bgr_color): 155 | return self.dm.BGR2RGB(bgr_color) 156 | 157 | def UnBindWindow(self): 158 | return self.dm.UnBindWindow() 159 | 160 | def CmpColor(self, x, y, color, sim): 161 | return self.dm.CmpColor(x, y, color, sim) 162 | 163 | def ClientToScreen(self, hwnd): 164 | return self.dm.ClientToScreen(hwnd) 165 | 166 | def ScreenToClient(self, hwnd): 167 | return self.dm.ScreenToClient(hwnd) 168 | 169 | def ShowScrMsg(self, x1, y1, x2, y2, msg, color): 170 | return self.dm.ShowScrMsg(x1, y1, x2, y2, msg, color) 171 | 172 | def SetMinRowGap(self, row_gap): 173 | return self.dm.SetMinRowGap(row_gap) 174 | 175 | def SetMinColGap(self, col_gap): 176 | return self.dm.SetMinColGap(col_gap) 177 | @wapper_decorator(0) 178 | def FindColor(self, x1, y1, x2, y2, color, sim, dir): 179 | return self.dm.FindColor(x1, y1, x2, y2, color, sim, dir) 180 | @wapper_decorator(0) 181 | def FindColorEx(self, x1, y1, x2, y2, color, sim, dir): 182 | return self.dm.FindColorEx(x1, y1, x2, y2, color, sim, dir) 183 | 184 | def SetWordLineHeight(self, line_height): 185 | return self.dm.SetWordLineHeight(line_height) 186 | 187 | def SetWordGap(self, word_gap): 188 | return self.dm.SetWordGap(word_gap) 189 | 190 | def SetRowGapNoDict(self, row_gap): 191 | return self.dm.SetRowGapNoDict(row_gap) 192 | 193 | def SetColGapNoDict(self, col_gap): 194 | return self.dm.SetColGapNoDict(col_gap) 195 | 196 | def SetWordLineHeightNoDict(self, line_height): 197 | return self.dm.SetWordLineHeightNoDict(line_height) 198 | 199 | def SetWordGapNoDict(self, word_gap): 200 | return self.dm.SetWordGapNoDict(word_gap) 201 | 202 | def GetWordResultCount(self, str): 203 | return self.dm.GetWordResultCount(str) 204 | 205 | def GetWordResultPos(self, str, index): 206 | return self.dm.GetWordResultPos(str, index) 207 | 208 | def GetWordResultStr(self, str, index): 209 | return self.dm.GetWordResultStr(str, index) 210 | 211 | def GetWords(self, x1, y1, x2, y2, color, sim): 212 | return self.dm.GetWords(x1, y1, x2, y2, color, sim) 213 | 214 | def GetWordsNoDict(self, x1, y1, x2, y2, color): 215 | return self.dm.GetWordsNoDict(x1, y1, x2, y2, color) 216 | 217 | def SetShowErrorMsg(self, show): 218 | return self.dm.SetShowErrorMsg(show) 219 | 220 | def GetClientSize(self, hwnd): 221 | return self.dm.GetClientSize(hwnd) 222 | def MoveWindow(self, hwnd, x, y): 223 | return self.dm.MoveWindow(hwnd, x, y) 224 | 225 | def GetColorHSV(self, x, y): 226 | return self.dm.GetColorHSV(x, y) 227 | 228 | def GetAveRGB(self, x1, y1, x2, y2): 229 | return self.dm.GetAveRGB(x1, y1, x2, y2) 230 | 231 | def GetAveHSV(self, x1, y1, x2, y2): 232 | return self.dm.GetAveHSV(x1, y1, x2, y2) 233 | 234 | def GetForegroundWindow(self): 235 | return self.dm.GetForegroundWindow() 236 | 237 | def GetForegroundFocus(self): 238 | return self.dm.GetForegroundFocus() 239 | 240 | def GetMousePointWindow(self): 241 | return self.dm.GetMousePointWindow() 242 | 243 | def GetPointWindow(self, x, y): 244 | return self.dm.GetPointWindow(x, y) 245 | 246 | def EnumWindow(self, parent, title, class_name, filter): 247 | return self.dm.EnumWindow(parent, title, class_name, filter) 248 | 249 | def GetWindowState(self, hwnd, flag): 250 | return self.dm.GetWindowState(hwnd, flag) 251 | 252 | def GetWindow(self, hwnd, flag): 253 | return self.dm.GetWindow(hwnd, flag) 254 | 255 | def GetSpecialWindow(self, flag): 256 | return self.dm.GetSpecialWindow(flag) 257 | 258 | def SetWindowText(self, hwnd, text): 259 | return self.dm.SetWindowText(hwnd, text) 260 | 261 | def SetWindowSize(self, hwnd, width, height): 262 | return self.dm.SetWindowSize(hwnd, width, height) 263 | 264 | def GetWindowRect(self, hwnd): 265 | return self.dm.GetWindowRect(hwnd) 266 | 267 | def GetWindowTitle(self, hwnd): 268 | return self.dm.GetWindowTitle(hwnd) 269 | 270 | def GetWindowClass(self, hwnd): 271 | return self.dm.GetWindowClass(hwnd) 272 | 273 | def SetWindowState(self, hwnd, flag): 274 | return self.dm.SetWindowState(hwnd, flag) 275 | 276 | def CreateFoobarRect(self, hwnd, x, y, w, h): 277 | return self.dm.CreateFoobarRect(hwnd, x, y, w, h) 278 | 279 | def CreateFoobarRoundRect(self, hwnd, x, y, w, h, rw, rh): 280 | return self.dm.CreateFoobarRoundRect(hwnd, x, y, w, h, rw, rh) 281 | 282 | def CreateFoobarEllipse(self, hwnd, x, y, w, h): 283 | return self.dm.CreateFoobarEllipse(hwnd, x, y, w, h) 284 | 285 | def CreateFoobarCustom(self, hwnd, x, y, pic, trans_color, sim): 286 | return self.dm.CreateFoobarCustom(hwnd, x, y, pic, trans_color, sim) 287 | 288 | def FoobarFillRect(self, hwnd, x1, y1, x2, y2, color): 289 | return self.dm.FoobarFillRect(hwnd, x1, y1, x2, y2, color) 290 | 291 | def FoobarDrawText(self, hwnd, x, y, w, h, text, color, align): 292 | return self.dm.FoobarDrawText(hwnd, x, y, w, h, text, color, align) 293 | 294 | def FoobarDrawPic(self, hwnd, x, y, pic, trans_color): 295 | return self.dm.FoobarDrawPic(hwnd, x, y, pic, trans_color) 296 | 297 | def FoobarUpdate(self, hwnd): 298 | return self.dm.FoobarUpdate(hwnd) 299 | 300 | def FoobarLock(self, hwnd): 301 | return self.dm.FoobarLock(hwnd) 302 | 303 | def FoobarUnlock(self, hwnd): 304 | return self.dm.FoobarUnlock(hwnd) 305 | 306 | def FoobarSetFont(self, hwnd, font_name, size, flag): 307 | return self.dm.FoobarSetFont(hwnd, font_name, size, flag) 308 | 309 | def FoobarTextRect(self, hwnd, x, y, w, h): 310 | return self.dm.FoobarTextRect(hwnd, x, y, w, h) 311 | 312 | def FoobarPrintText(self, hwnd, text, color): 313 | return self.dm.FoobarPrintText(hwnd, text, color) 314 | 315 | def FoobarClearText(self, hwnd): 316 | return self.dm.FoobarClearText(hwnd) 317 | 318 | def FoobarTextLineGap(self, hwnd, gap): 319 | return self.dm.FoobarTextLineGap(hwnd, gap) 320 | 321 | def Play(self, file): 322 | return self.dm.Play(file) 323 | 324 | def FaqCapture(self, x1, y1, x2, y2, quality, delay, time): 325 | return self.dm.FaqCapture(x1, y1, x2, y2, quality, delay, time) 326 | 327 | def FaqRelease(self, handle): 328 | return self.dm.FaqRelease(handle) 329 | 330 | def FaqSend(self, server, handle, request_type, time_out): 331 | return self.dm.FaqSend(server, handle, request_type, time_out) 332 | 333 | def Beep(self, fre, delay): 334 | return self.dm.Beep(fre, delay) 335 | 336 | def FoobarClose(self, hwnd): 337 | return self.dm.FoobarClose(hwnd) 338 | 339 | def MoveDD(self, dx, dy): 340 | return self.dm.MoveDD(dx, dy) 341 | 342 | def FaqGetSize(self, handle): 343 | return self.dm.FaqGetSize(handle) 344 | 345 | def LoadPic(self, pic_name): 346 | return self.dm.LoadPic(pic_name) 347 | 348 | def FreePic(self, pic_name): 349 | return self.dm.FreePic(pic_name) 350 | 351 | def GetScreenData(self, x1, y1, x2, y2): 352 | return self.dm.GetScreenData(x1, y1, x2, y2) 353 | 354 | def FreeScreenData(self, handle): 355 | return self.dm.FreeScreenData(handle) 356 | 357 | def WheelUp(self): 358 | return self.dm.WheelUp() 359 | 360 | def WheelDown(self): 361 | return self.dm.WheelDown() 362 | 363 | def SetMouseDelay(self, type, delay): 364 | return self.dm.SetMouseDelay(type, delay) 365 | 366 | def SetKeypadDelay(self, type, delay): 367 | return self.dm.SetKeypadDelay(type, delay) 368 | 369 | def GetEnv(self, index, name): 370 | return self.dm.GetEnv(index, name) 371 | 372 | def SetEnv(self, index, name, value): 373 | return self.dm.SetEnv(index, name, value) 374 | 375 | def SendString(self, hwnd, str): 376 | return self.dm.SendString(hwnd, str) 377 | 378 | def DelEnv(self, index, name): 379 | return self.dm.DelEnv(index, name) 380 | 381 | def GetPath(self): 382 | return self.dm.GetPath() 383 | 384 | def SetDict(self, index, dict_name): 385 | return self.dm.SetDict(index, dict_name) 386 | @wapper_decorator(-1) 387 | def FindPic(self, x1, y1, x2, y2, pic_name, delta_color, sim, dir): 388 | return self.dm.FindPic(x1, y1, x2, y2, pic_name, delta_color, sim, dir) 389 | 390 | def FindPicEx(self, x1, y1, x2, y2, pic_name, delta_color, sim, dir): 391 | return self.dm.FindPicEx(x1, y1, x2, y2, pic_name, delta_color, sim, dir) 392 | 393 | def SetClientSize(self, hwnd, width, height): 394 | return self.dm.SetClientSize(hwnd, width, height) 395 | 396 | def ReadInt(self, hwnd, addr, type): 397 | return self.dm.ReadInt(hwnd, addr, type) 398 | 399 | def ReadFloat(self, hwnd, addr): 400 | return self.dm.ReadFloat(hwnd, addr) 401 | 402 | def ReadDouble(self, hwnd, addr): 403 | return self.dm.ReadDouble(hwnd, addr) 404 | 405 | def FindInt(self, hwnd, addr_range, int_value_min, int_value_max, type): 406 | return self.dm.FindInt(hwnd, addr_range, int_value_min, int_value_max, type) 407 | 408 | def FindFloat(self, hwnd, addr_range, float_value_min, float_value_max): 409 | return self.dm.FindFloat(hwnd, addr_range, float_value_min, float_value_max) 410 | 411 | def FindDouble(self, hwnd, addr_range, double_value_min, double_value_max): 412 | return self.dm.FindDouble(hwnd, addr_range, double_value_min, double_value_max) 413 | 414 | def FindString(self, hwnd, addr_range, string_value, type): 415 | return self.dm.FindString(hwnd, addr_range, string_value, type) 416 | 417 | def GetModuleBaseAddr(self, hwnd, module_name): 418 | return self.dm.GetModuleBaseAddr(hwnd, module_name) 419 | 420 | def MoveToEx(self, x, y, w, h): 421 | return self.dm.MoveToEx(x, y, w, h) 422 | 423 | def MatchPicName(self, pic_name): 424 | return self.dm.MatchPicName(pic_name) 425 | 426 | def AddDict(self, index, dict_info): 427 | return self.dm.AddDict(index, dict_info) 428 | 429 | def EnterCri(self): 430 | return self.dm.EnterCri() 431 | 432 | def LeaveCri(self): 433 | return self.dm.LeaveCri() 434 | 435 | def WriteInt(self, hwnd, addr, type, v): 436 | return self.dm.WriteInt(hwnd, addr, type, v) 437 | 438 | def WriteFloat(self, hwnd, addr, v): 439 | return self.dm.WriteFloat(hwnd, addr, v) 440 | 441 | def WriteDouble(self, hwnd, addr, v): 442 | return self.dm.WriteDouble(hwnd, addr, v) 443 | 444 | def WriteString(self, hwnd, addr, type, v): 445 | return self.dm.WriteString(hwnd, addr, type, v) 446 | 447 | def AsmAdd(self, asm_ins): 448 | return self.dm.AsmAdd(asm_ins) 449 | 450 | def AsmClear(self): 451 | return self.dm.AsmClear() 452 | 453 | def AsmCall(self, hwnd, mode): 454 | return self.dm.AsmCall(hwnd, mode) 455 | @wapper_decorator(0) 456 | def FindMultiColor(self, x1, y1, x2, y2, first_color, offset_color, sim, dir): 457 | return self.dm.FindMultiColor(x1, y1, x2, y2, first_color, offset_color, sim, dir) 458 | def FindMultiColorEx(self, x1, y1, x2, y2, first_color, offset_color, sim, dir): 459 | return self.dm.FindMultiColorEx(x1, y1, x2, y2, first_color, offset_color, sim, dir) 460 | 461 | def Assemble(self, base_addr, is_64bit): 462 | return self.dm.Assemble(base_addr, is_64bit) 463 | 464 | def DisAssemble(self, asm_code, base_addr, is_64bit): 465 | return self.dm.DisAssemble(asm_code, base_addr, is_64bit) 466 | 467 | def SetWindowTransparent(self, hwnd, v): 468 | return self.dm.SetWindowTransparent(hwnd, v) 469 | 470 | def ReadData(self, hwnd, addr, len): 471 | return self.dm.ReadData(hwnd, addr, len) 472 | 473 | def WriteData(self, hwnd, addr, data): 474 | return self.dm.WriteData(hwnd, addr, data) 475 | 476 | def FindData(self, hwnd, addr_range, data): 477 | return self.dm.FindData(hwnd, addr_range, data) 478 | 479 | def SetPicPwd(self, pwd): 480 | return self.dm.SetPicPwd(pwd) 481 | 482 | def Log(self, info): 483 | return self.dm.Log(info) 484 | @wapper_decorator("-1|-1|-1") 485 | def FindStrE(self, x1, y1, x2, y2, str, color, sim): 486 | return self.dm.FindStrE(x1, y1, x2, y2, str, color, sim) 487 | @wapper_decorator("-1|-1") 488 | def FindColorE(self, x1, y1, x2, y2, color, sim, dir): 489 | return self.dm.FindColorE(x1, y1, x2, y2, color, sim, dir) 490 | 491 | def FindPicE(self, x1, y1, x2, y2, pic_name, delta_color, sim, dir): 492 | return self.dm.FindPicE(x1, y1, x2, y2, pic_name, delta_color, sim, dir) 493 | @wapper_decorator("-1|-1") 494 | def FindMultiColorE(self, x1, y1, x2, y2, first_color, offset_color, sim, dir): 495 | return self.dm.FindMultiColorE(x1, y1, x2, y2, first_color, offset_color, sim, dir) 496 | 497 | def SetExactOcr(self, exact_ocr): 498 | return self.dm.SetExactOcr(exact_ocr) 499 | 500 | def ReadString(self, hwnd, addr, type, len): 501 | return self.dm.ReadString(hwnd, addr, type, len) 502 | 503 | def FoobarTextPrintDir(self, hwnd, dir): 504 | return self.dm.FoobarTextPrintDir(hwnd, dir) 505 | 506 | def OcrEx(self, x1, y1, x2, y2, color, sim): 507 | return self.dm.OcrEx(x1, y1, x2, y2, color, sim) 508 | 509 | def SetDisplayInput(self, mode): 510 | return self.dm.SetDisplayInput(mode) 511 | 512 | def GetTime(self): 513 | return self.dm.GetTime() 514 | 515 | def GetScreenWidth(self): 516 | return self.dm.GetScreenWidth() 517 | 518 | def GetScreenHeight(self): 519 | return self.dm.GetScreenHeight() 520 | 521 | def BindWindowEx(self, hwnd, display, mouse, keypad, public_desc, mode): 522 | return self.dm.BindWindowEx(hwnd, display, mouse, keypad, public_desc, mode) 523 | 524 | def GetDiskSerial(self, index): 525 | return self.dm.GetDiskSerial(index) 526 | 527 | def Md5(self, str): 528 | return self.dm.Md5(str) 529 | 530 | def GetMac(self): 531 | return self.dm.GetMac() 532 | 533 | def ActiveInputMethod(self, hwnd, id): 534 | return self.dm.ActiveInputMethod(hwnd, id) 535 | 536 | def CheckInputMethod(self, hwnd, id): 537 | return self.dm.CheckInputMethod(hwnd, id) 538 | 539 | def FindInputMethod(self, id): 540 | return self.dm.FindInputMethod(id) 541 | 542 | def GetCursorPos(self): 543 | return self.dm.GetCursorPos() 544 | 545 | def BindWindow(self, hwnd, display, mouse, keypad, mode): 546 | return self.dm.BindWindow(hwnd, display, mouse, keypad, mode) 547 | @wapper_decorator(0) 548 | def FindWindow(self, class_name, title_name): 549 | return self.dm.FindWindow(class_name, title_name) 550 | 551 | def GetScreenDepth(self): 552 | return self.dm.GetScreenDepth() 553 | 554 | def SetScreen(self, width, height, depth): 555 | return self.dm.SetScreen(width, height, depth) 556 | 557 | def ExitOs(self, type): 558 | return self.dm.ExitOs(type) 559 | 560 | def GetDir(self, type): 561 | return self.dm.GetDir(type) 562 | 563 | def GetOsType(self): 564 | return self.dm.GetOsType() 565 | 566 | def FindWindowEx(self, parent, class_name, title_name): 567 | return self.dm.FindWindowEx(parent, class_name, title_name) 568 | 569 | def SetExportDict(self, index, dict_name): 570 | return self.dm.SetExportDict(index, dict_name) 571 | 572 | def GetCursorShape(self): 573 | return self.dm.GetCursorShape() 574 | 575 | def DownCpu(self, type, rate): 576 | return self.dm.DownCpu(type, rate) 577 | 578 | def GetCursorSpot(self): 579 | return self.dm.GetCursorSpot() 580 | 581 | def SendString2(self, hwnd, str): 582 | return self.dm.SendString2(hwnd, str) 583 | 584 | def FaqPost(self, server, handle, request_type, time_out): 585 | return self.dm.FaqPost(server, handle, request_type, time_out) 586 | 587 | def FaqFetch(self): 588 | return self.dm.FaqFetch() 589 | 590 | def FetchWord(self, x1, y1, x2, y2, color, word): 591 | return self.dm.FetchWord(x1, y1, x2, y2, color, word) 592 | @wapper_decorator(0) 593 | def CaptureJpg(self, x1, y1, x2, y2, file, quality): 594 | return self.dm.CaptureJpg(x1, y1, x2, y2, file, quality) 595 | 596 | def FindStrWithFont(self, x1, y1, x2, y2, str, color, sim, font_name, font_size, flag): 597 | return self.dm.FindStrWithFont(x1, y1, x2, y2, str, color, sim, font_name, font_size, flag) 598 | 599 | def FindStrWithFontE(self, x1, y1, x2, y2, str, color, sim, font_name, font_size, flag): 600 | return self.dm.FindStrWithFontE(x1, y1, x2, y2, str, color, sim, font_name, font_size, flag) 601 | 602 | def FindStrWithFontEx(self, x1, y1, x2, y2, str, color, sim, font_name, font_size, flag): 603 | return self.dm.FindStrWithFontEx(x1, y1, x2, y2, str, color, sim, font_name, font_size, flag) 604 | 605 | def GetDictInfo(self, str, font_name, font_size, flag): 606 | return self.dm.GetDictInfo(str, font_name, font_size, flag) 607 | 608 | def SaveDict(self, index, file): 609 | return self.dm.SaveDict(index, file) 610 | 611 | def GetWindowProcessId(self, hwnd): 612 | return self.dm.GetWindowProcessId(hwnd) 613 | 614 | def GetWindowProcessPath(self, hwnd): 615 | return self.dm.GetWindowProcessPath(hwnd) 616 | 617 | def LockInput(self, lock): 618 | return self.dm.LockInput(lock) 619 | 620 | def GetPicSize(self, pic_name): 621 | return self.dm.GetPicSize(pic_name) 622 | 623 | def GetID(self): 624 | return self.dm.GetID() 625 | @wapper_decorator(0) 626 | def CapturePng(self, x1, y1, x2, y2, file): 627 | return self.dm.CapturePng(x1, y1, x2, y2, file) 628 | @wapper_decorator(0) 629 | def CaptureGif(self, x1, y1, x2, y2, file, delay, time): 630 | return self.dm.CaptureGif(x1, y1, x2, y2, file, delay, time) 631 | @wapper_decorator(0) 632 | def ImageToBmp(self, pic_name, bmp_name): 633 | return self.dm.ImageToBmp(pic_name, bmp_name) 634 | 635 | def FindStrFast(self, x1, y1, x2, y2, str, color, sim): 636 | return self.dm.FindStrFast(x1, y1, x2, y2, str, color, sim) 637 | 638 | def FindStrFastEx(self, x1, y1, x2, y2, str, color, sim): 639 | return self.dm.FindStrFastEx(x1, y1, x2, y2, str, color, sim) 640 | 641 | def FindStrFastE(self, x1, y1, x2, y2, str, color, sim): 642 | return self.dm.FindStrFastE(x1, y1, x2, y2, str, color, sim) 643 | 644 | def EnableDisplayDebug(self, enable_debug): 645 | return self.dm.EnableDisplayDebug(enable_debug) 646 | 647 | def CapturePre(self, file): 648 | return self.dm.CapturePre(file) 649 | 650 | def RegEx(self, code, Ver, ip): 651 | return self.dm.RegEx(code, Ver, ip) 652 | 653 | def GetMachineCode(self): 654 | return self.dm.GetMachineCode() 655 | 656 | def SetClipboard(self, data): 657 | return self.dm.SetClipboard(data) 658 | 659 | def GetClipboard(self): 660 | return self.dm.GetClipboard() 661 | 662 | def GetNowDict(self): 663 | return self.dm.GetNowDict() 664 | 665 | def Is64Bit(self): 666 | return self.dm.Is64Bit() 667 | 668 | def GetColorNum(self, x1, y1, x2, y2, color, sim): 669 | return self.dm.GetColorNum(x1, y1, x2, y2, color, sim) 670 | 671 | def EnumWindowByProcess(self, process_name, title, class_name, filter): 672 | return self.dm.EnumWindowByProcess(process_name, title, class_name, filter) 673 | 674 | def GetDictCount(self, index): 675 | return self.dm.GetDictCount(index) 676 | 677 | def GetLastError(self): 678 | return self.dm.GetLastError() 679 | 680 | def GetNetTime(self): 681 | return self.dm.GetNetTime() 682 | 683 | def EnableGetColorByCapture(self, en): 684 | return self.dm.EnableGetColorByCapture(en) 685 | 686 | def CheckUAC(self): 687 | return self.dm.CheckUAC() 688 | 689 | def SetUAC(self, uac): 690 | return self.dm.SetUAC(uac) 691 | 692 | def DisableFontSmooth(self): 693 | return self.dm.DisableFontSmooth() 694 | 695 | def CheckFontSmooth(self): 696 | return self.dm.CheckFontSmooth() 697 | 698 | def SetDisplayAcceler(self, level): 699 | return self.dm.SetDisplayAcceler(level) 700 | 701 | def FindWindowByProcess(self, process_name, class_name, title_name): 702 | return self.dm.FindWindowByProcess(process_name, class_name, title_name) 703 | 704 | def FindWindowByProcessId(self, process_id, class_name, title_name): 705 | return self.dm.FindWindowByProcessId(process_id, class_name, title_name) 706 | 707 | def ReadIni(self, section, key, file): 708 | return self.dm.ReadIni(section, key, file) 709 | 710 | def WriteIni(self, section, key, v, file): 711 | return self.dm.WriteIni(section, key, v, file) 712 | 713 | def RunApp(self, path, mode): 714 | return self.dm.RunApp(path, mode) 715 | 716 | def delay(self, mis): 717 | return self.dm.delay(mis) 718 | 719 | def FindWindowSuper(self, spec1, flag1, type1, spec2, flag2, type2): 720 | return self.dm.FindWindowSuper(spec1, flag1, type1, spec2, flag2, type2) 721 | 722 | def ExcludePos(self, all_pos, type, x1, y1, x2, y2): 723 | return self.dm.ExcludePos(all_pos, type, x1, y1, x2, y2) 724 | 725 | def FindNearestPos(self, all_pos, type, x, y): 726 | return self.dm.FindNearestPos(all_pos, type, x, y) 727 | 728 | def SortPosDistance(self, all_pos, type, x, y): 729 | return self.dm.SortPosDistance(all_pos, type, x, y) 730 | 731 | def FindPicMem(self, x1, y1, x2, y2, pic_info, delta_color, sim, dir): 732 | return self.dm.FindPicMem(x1, y1, x2, y2, pic_info, delta_color, sim, dir) 733 | 734 | def FindPicMemEx(self, x1, y1, x2, y2, pic_info, delta_color, sim, dir): 735 | return self.dm.FindPicMemEx(x1, y1, x2, y2, pic_info, delta_color, sim, dir) 736 | 737 | def FindPicMemE(self, x1, y1, x2, y2, pic_info, delta_color, sim, dir): 738 | return self.dm.FindPicMemE(x1, y1, x2, y2, pic_info, delta_color, sim, dir) 739 | 740 | def AppendPicAddr(self, pic_info, addr, size): 741 | return self.dm.AppendPicAddr(pic_info, addr, size) 742 | 743 | def WriteFile(self, file, content): 744 | return self.dm.WriteFile(file, content) 745 | 746 | def Stop(self, id): 747 | return self.dm.Stop(id) 748 | 749 | def SetDictMem(self, index, addr, size): 750 | return self.dm.SetDictMem(index, addr, size) 751 | 752 | def GetNetTimeSafe(self): 753 | return self.dm.GetNetTimeSafe() 754 | 755 | def ForceUnBindWindow(self, hwnd): 756 | return self.dm.ForceUnBindWindow(hwnd) 757 | 758 | def ReadIniPwd(self, section, key, file, pwd): 759 | return self.dm.ReadIniPwd(section, key, file, pwd) 760 | 761 | def WriteIniPwd(self, section, key, v, file, pwd): 762 | return self.dm.WriteIniPwd(section, key, v, file, pwd) 763 | 764 | def DecodeFile(self, file, pwd): 765 | return self.dm.DecodeFile(file, pwd) 766 | 767 | def KeyDownChar(self, key_str): 768 | return self.dm.KeyDownChar(key_str) 769 | 770 | def KeyUpChar(self, key_str): 771 | return self.dm.KeyUpChar(key_str) 772 | 773 | def KeyPressChar(self, key_str): 774 | return self.dm.KeyPressChar(key_str) 775 | 776 | def KeyPressStr(self, key_str, delay): 777 | return self.dm.KeyPressStr(key_str, delay) 778 | 779 | def EnableKeypadPatch(self, en): 780 | return self.dm.EnableKeypadPatch(en) 781 | 782 | def EnableKeypadSync(self, en, time_out): 783 | return self.dm.EnableKeypadSync(en, time_out) 784 | 785 | def EnableMouseSync(self, en, time_out): 786 | return self.dm.EnableMouseSync(en, time_out) 787 | 788 | def DmGuard(self, en, type): 789 | return self.dm.DmGuard(en, type) 790 | 791 | def FaqCaptureFromFile(self, x1, y1, x2, y2, file, quality): 792 | return self.dm.FaqCaptureFromFile(x1, y1, x2, y2, file, quality) 793 | 794 | def FindIntEx(self, hwnd, addr_range, int_value_min, int_value_max, type, step, multi_thread, mode): 795 | return self.dm.FindIntEx(hwnd, addr_range, int_value_min, int_value_max, type, step, multi_thread, mode) 796 | 797 | def FindFloatEx(self, hwnd, addr_range, float_value_min, float_value_max, step, multi_thread, mode): 798 | return self.dm.FindFloatEx(hwnd, addr_range, float_value_min, float_value_max, step, multi_thread, mode) 799 | 800 | def FindDoubleEx(self, hwnd, addr_range, double_value_min, double_value_max, step, multi_thread, mode): 801 | return self.dm.FindDoubleEx(hwnd, addr_range, double_value_min, double_value_max, step, multi_thread, mode) 802 | 803 | def FindStringEx(self, hwnd, addr_range, string_value, type, step, multi_thread, mode): 804 | return self.dm.FindStringEx(hwnd, addr_range, string_value, type, step, multi_thread, mode) 805 | 806 | def FindDataEx(self, hwnd, addr_range, data, step, multi_thread, mode): 807 | return self.dm.FindDataEx(hwnd, addr_range, data, step, multi_thread, mode) 808 | 809 | def EnableRealMouse(self, en, mousedelay, mousestep): 810 | return self.dm.EnableRealMouse(en, mousedelay, mousestep) 811 | 812 | def EnableRealKeypad(self, en): 813 | return self.dm.EnableRealKeypad(en) 814 | 815 | def SendStringIme(self, str): 816 | return self.dm.SendStringIme(str) 817 | 818 | def FoobarDrawLine(self, hwnd, x1, y1, x2, y2, color, style, width): 819 | return self.dm.FoobarDrawLine(hwnd, x1, y1, x2, y2, color, style, width) 820 | 821 | def FindStrEx(self, x1, y1, x2, y2, str, color, sim): 822 | return self.dm.FindStrEx(x1, y1, x2, y2, str, color, sim) 823 | 824 | def IsBind(self, hwnd): 825 | return self.dm.IsBind(hwnd) 826 | 827 | def SetDisplayDelay(self, t): 828 | return self.dm.SetDisplayDelay(t) 829 | 830 | def GetDmCount(self): 831 | return self.dm.GetDmCount() 832 | 833 | def DisableScreenSave(self): 834 | return self.dm.DisableScreenSave() 835 | 836 | def DisablePowerSave(self): 837 | return self.dm.DisablePowerSave() 838 | 839 | def SetMemoryHwndAsProcessId(self, en): 840 | return self.dm.SetMemoryHwndAsProcessId(en) 841 | 842 | def FindShape(self, x1, y1, x2, y2, offset_color, sim, dir): 843 | return self.dm.FindShape(x1, y1, x2, y2, offset_color, sim, dir) 844 | 845 | def FindShapeE(self, x1, y1, x2, y2, offset_color, sim, dir): 846 | return self.dm.FindShapeE(x1, y1, x2, y2, offset_color, sim, dir) 847 | 848 | def FindShapeEx(self, x1, y1, x2, y2, offset_color, sim, dir): 849 | return self.dm.FindShapeEx(x1, y1, x2, y2, offset_color, sim, dir) 850 | 851 | def FindStrS(self, x1, y1, x2, y2, str, color, sim): 852 | return self.dm.FindStrS(x1, y1, x2, y2, str, color, sim) 853 | 854 | def FindStrExS(self, x1, y1, x2, y2, str, color, sim): 855 | return self.dm.FindStrExS(x1, y1, x2, y2, str, color, sim) 856 | 857 | def FindStrFastS(self, x1, y1, x2, y2, str, color, sim): 858 | return self.dm.FindStrFastS(x1, y1, x2, y2, str, color, sim) 859 | 860 | def FindStrFastExS(self, x1, y1, x2, y2, str, color, sim): 861 | return self.dm.FindStrFastExS(x1, y1, x2, y2, str, color, sim) 862 | 863 | def FindPicS(self, x1, y1, x2, y2, pic_name, delta_color, sim, dir): 864 | return self.dm.FindPicS(x1, y1, x2, y2, pic_name, delta_color, sim, dir) 865 | 866 | def FindPicExS(self, x1, y1, x2, y2, pic_name, delta_color, sim, dir): 867 | return self.dm.FindPicExS(x1, y1, x2, y2, pic_name, delta_color, sim, dir) 868 | 869 | def ClearDict(self, index): 870 | return self.dm.ClearDict(index) 871 | 872 | def GetMachineCodeNoMac(self): 873 | return self.dm.GetMachineCodeNoMac() 874 | 875 | def GetClientRect(self, hwnd): 876 | return self.dm.GetClientRect(hwnd) 877 | 878 | def EnableFakeActive(self, en): 879 | return self.dm.EnableFakeActive(en) 880 | 881 | def GetScreenDataBmp(self, x1, y1, x2, y2): 882 | return self.dm.GetScreenDataBmp(x1, y1, x2, y2) 883 | 884 | def EncodeFile(self, file, pwd): 885 | return self.dm.EncodeFile(file, pwd) 886 | 887 | def GetCursorShapeEx(self, type): 888 | return self.dm.GetCursorShapeEx(type) 889 | 890 | def FaqCancel(self): 891 | return self.dm.FaqCancel() 892 | 893 | def IntToData(self, int_value, type): 894 | return self.dm.IntToData(int_value, type) 895 | 896 | def FloatToData(self, float_value): 897 | return self.dm.FloatToData(float_value) 898 | 899 | def DoubleToData(self, double_value): 900 | return self.dm.DoubleToData(double_value) 901 | 902 | def StringToData(self, string_value, type): 903 | return self.dm.StringToData(string_value, type) 904 | 905 | def SetMemoryFindResultToFile(self, file): 906 | return self.dm.SetMemoryFindResultToFile(file) 907 | 908 | def EnableBind(self, en): 909 | return self.dm.EnableBind(en) 910 | 911 | def SetSimMode(self, mode): 912 | return self.dm.SetSimMode(mode) 913 | 914 | def LockMouseRect(self, x1, y1, x2, y2): 915 | return self.dm.LockMouseRect(x1, y1, x2, y2) 916 | 917 | def SendPaste(self, hwnd): 918 | return self.dm.SendPaste(hwnd) 919 | 920 | def IsDisplayDead(self, x1, y1, x2, y2, t): 921 | return self.dm.IsDisplayDead(x1, y1, x2, y2, t) 922 | 923 | def GetKeyState(self, vk): 924 | return self.dm.GetKeyState(vk) 925 | 926 | def CopyFile(self, src_file, dst_file, over): 927 | return self.dm.CopyFile(src_file, dst_file, over) 928 | 929 | def IsFileExist(self, file): 930 | return self.dm.IsFileExist(file) 931 | 932 | def DeleteFile(self, file): 933 | return self.dm.DeleteFile(file) 934 | 935 | def MoveFile(self, src_file, dst_file): 936 | return self.dm.MoveFile(src_file, dst_file) 937 | 938 | def CreateFolder(self, folder_name): 939 | return self.dm.CreateFolder(folder_name) 940 | 941 | def DeleteFolder(self, folder_name): 942 | return self.dm.DeleteFolder(folder_name) 943 | 944 | def GetFileLength(self, file): 945 | return self.dm.GetFileLength(file) 946 | 947 | def ReadFile(self, file): 948 | return self.dm.ReadFile(file) 949 | 950 | def WaitKey(self, key_code, time_out): 951 | return self.dm.WaitKey(key_code, time_out) 952 | 953 | def DeleteIni(self, section, key, file): 954 | return self.dm.DeleteIni(section, key, file) 955 | 956 | def DeleteIniPwd(self, section, key, file, pwd): 957 | return self.dm.DeleteIniPwd(section, key, file, pwd) 958 | 959 | def EnableSpeedDx(self, en): 960 | return self.dm.EnableSpeedDx(en) 961 | 962 | def EnableIme(self, en): 963 | return self.dm.EnableIme(en) 964 | 965 | def Reg(self, code, Ver): 966 | return self.dm.Reg(code, Ver) 967 | 968 | def SelectFile(self): 969 | return self.dm.SelectFile() 970 | 971 | def SelectDirectory(self): 972 | return self.dm.SelectDirectory() 973 | 974 | def LockDisplay(self, lock): 975 | return self.dm.LockDisplay(lock) 976 | 977 | def FoobarSetSave(self, hwnd, file, en, header): 978 | return self.dm.FoobarSetSave(hwnd, file, en, header) 979 | 980 | def EnumWindowSuper(self, spec1, flag1, type1, spec2, flag2, type2, sort): 981 | return self.dm.EnumWindowSuper(spec1, flag1, type1, spec2, flag2, type2, sort) 982 | 983 | def DownloadFile(self, url, save_file, timeout): 984 | return self.dm.DownloadFile(url, save_file, timeout) 985 | 986 | def EnableKeypadMsg(self, en): 987 | return self.dm.EnableKeypadMsg(en) 988 | 989 | def EnableMouseMsg(self, en): 990 | return self.dm.EnableMouseMsg(en) 991 | 992 | def RegNoMac(self, code, Ver): 993 | return self.dm.RegNoMac(code, Ver) 994 | 995 | def RegExNoMac(self, code, Ver, ip): 996 | return self.dm.RegExNoMac(code, Ver, ip) 997 | 998 | def SetEnumWindowDelay(self, delay): 999 | return self.dm.SetEnumWindowDelay(delay) 1000 | 1001 | def FindMulColor(self, x1, y1, x2, y2, color, sim): 1002 | return self.dm.FindMulColor(x1, y1, x2, y2, color, sim) 1003 | 1004 | def GetDict(self, index, font_index): 1005 | return self.dm.GetDict(index, font_index) 1006 | 1007 | def GetBindWindow(self): 1008 | return self.dm.GetBindWindow() 1009 | 1010 | def FoobarStartGif(self, hwnd, x, y, pic_name, repeat_limit, delay): 1011 | return self.dm.FoobarStartGif(hwnd, x, y, pic_name, repeat_limit, delay) 1012 | 1013 | def FoobarStopGif(self, hwnd, x, y, pic_name): 1014 | return self.dm.FoobarStopGif(hwnd, x, y, pic_name) 1015 | 1016 | def FreeProcessMemory(self, hwnd): 1017 | return self.dm.FreeProcessMemory(hwnd) 1018 | 1019 | def ReadFileData(self, file, start_pos, end_pos): 1020 | return self.dm.ReadFileData(file, start_pos, end_pos) 1021 | 1022 | def VirtualAllocEx(self, hwnd, addr, size, type): 1023 | return self.dm.VirtualAllocEx(hwnd, addr, size, type) 1024 | 1025 | def VirtualFreeEx(self, hwnd, addr): 1026 | return self.dm.VirtualFreeEx(hwnd, addr) 1027 | 1028 | def GetCommandLine(self, hwnd): 1029 | return self.dm.GetCommandLine(hwnd) 1030 | 1031 | def TerminateProcess(self, pid): 1032 | return self.dm.TerminateProcess(pid) 1033 | 1034 | def GetNetTimeByIp(self, ip): 1035 | return self.dm.GetNetTimeByIp(ip) 1036 | 1037 | def EnumProcess(self, name): 1038 | return self.dm.EnumProcess(name) 1039 | 1040 | def GetProcessInfo(self, pid): 1041 | return self.dm.GetProcessInfo(pid) 1042 | 1043 | def ReadIntAddr(self, hwnd, addr, type): 1044 | return self.dm.ReadIntAddr(hwnd, addr, type) 1045 | 1046 | def ReadDataAddr(self, hwnd, addr, len): 1047 | return self.dm.ReadDataAddr(hwnd, addr, len) 1048 | 1049 | def ReadDoubleAddr(self, hwnd, addr): 1050 | return self.dm.ReadDoubleAddr(hwnd, addr) 1051 | 1052 | def ReadFloatAddr(self, hwnd, addr): 1053 | return self.dm.ReadFloatAddr(hwnd, addr) 1054 | 1055 | def ReadStringAddr(self, hwnd, addr, type, len): 1056 | return self.dm.ReadStringAddr(hwnd, addr, type, len) 1057 | 1058 | def WriteDataAddr(self, hwnd, addr, data): 1059 | return self.dm.WriteDataAddr(hwnd, addr, data) 1060 | 1061 | def WriteDoubleAddr(self, hwnd, addr, v): 1062 | return self.dm.WriteDoubleAddr(hwnd, addr, v) 1063 | 1064 | def WriteFloatAddr(self, hwnd, addr, v): 1065 | return self.dm.WriteFloatAddr(hwnd, addr, v) 1066 | 1067 | def WriteIntAddr(self, hwnd, addr, type, v): 1068 | return self.dm.WriteIntAddr(hwnd, addr, type, v) 1069 | 1070 | def WriteStringAddr(self, hwnd, addr, type, v): 1071 | return self.dm.WriteStringAddr(hwnd, addr, type, v) 1072 | 1073 | def Delays(self, min_s, max_s): 1074 | return self.dm.Delays(min_s, max_s) 1075 | @wapper_decorator(0) 1076 | def FindColorBlock(self, x1, y1, x2, y2, color, sim, count, width, height): 1077 | return self.dm.FindColorBlock(x1, y1, x2, y2, color, sim, count, width, height) 1078 | def FindColorBlockEx(self, x1, y1, x2, y2, color, sim, count, width, height): 1079 | return self.dm.FindColorBlockEx(x1, y1, x2, y2, color, sim, count, width, height) 1080 | 1081 | def OpenProcess(self, pid): 1082 | return self.dm.OpenProcess(pid) 1083 | 1084 | def EnumIniSection(self, file): 1085 | return self.dm.EnumIniSection(file) 1086 | 1087 | def EnumIniSectionPwd(self, file, pwd): 1088 | return self.dm.EnumIniSectionPwd(file, pwd) 1089 | 1090 | def EnumIniKey(self, section, file): 1091 | return self.dm.EnumIniKey(section, file) 1092 | 1093 | def EnumIniKeyPwd(self, section, file, pwd): 1094 | return self.dm.EnumIniKeyPwd(section, file, pwd) 1095 | 1096 | def SwitchBindWindow(self, hwnd): 1097 | return self.dm.SwitchBindWindow(hwnd) 1098 | 1099 | def InitCri(self): 1100 | return self.dm.InitCri() 1101 | 1102 | def SendStringIme2(self, hwnd, str, mode): 1103 | return self.dm.SendStringIme2(hwnd, str, mode) 1104 | 1105 | def EnumWindowByProcessId(self, pid, title, class_name, filter): 1106 | return self.dm.EnumWindowByProcessId(pid, title, class_name, filter) 1107 | 1108 | def GetDisplayInfo(self): 1109 | return self.dm.GetDisplayInfo() 1110 | 1111 | def EnableFontSmooth(self): 1112 | return self.dm.EnableFontSmooth() 1113 | 1114 | def OcrExOne(self, x1, y1, x2, y2, color, sim): 1115 | return self.dm.OcrExOne(x1, y1, x2, y2, color, sim) 1116 | 1117 | def SetAero(self, en): 1118 | return self.dm.SetAero(en) 1119 | 1120 | def FoobarSetTrans(self, hwnd, trans, color, sim): 1121 | return self.dm.FoobarSetTrans(hwnd, trans, color, sim) 1122 | 1123 | def EnablePicCache(self, en): 1124 | return self.dm.EnablePicCache(en) 1125 | 1126 | def FaqIsPosted(self): 1127 | return self.dm.FaqIsPosted() 1128 | 1129 | def LoadPicByte(self, addr, size, name): 1130 | return self.dm.LoadPicByte(addr, size, name) 1131 | 1132 | def MiddleDown(self): 1133 | return self.dm.MiddleDown() 1134 | 1135 | def MiddleUp(self): 1136 | return self.dm.MiddleUp() 1137 | 1138 | def FaqCaptureString(self, str): 1139 | return self.dm.FaqCaptureString(str) 1140 | 1141 | def VirtualProtectEx(self, hwnd, addr, size, type, old_protect): 1142 | return self.dm.VirtualProtectEx(hwnd, addr, size, type, old_protect) 1143 | 1144 | def SetMouseSpeed(self, speed): 1145 | return self.dm.SetMouseSpeed(speed) 1146 | 1147 | def GetMouseSpeed(self): 1148 | return self.dm.GetMouseSpeed() 1149 | 1150 | def EnableMouseAccuracy(self, en): 1151 | return self.dm.EnableMouseAccuracy(en) 1152 | 1153 | def SetExcludeRegion(self, type, info): 1154 | return self.dm.SetExcludeRegion(type, info) 1155 | 1156 | def EnableShareDict(self, en): 1157 | return self.dm.EnableShareDict(en) 1158 | 1159 | def DisableCloseDisplayAndSleep(self): 1160 | return self.dm.DisableCloseDisplayAndSleep() 1161 | 1162 | def Int64ToInt32(self, v): 1163 | return self.dm.Int64ToInt32(v) 1164 | 1165 | def GetLocale(self): 1166 | return self.dm.GetLocale() 1167 | 1168 | def SetLocale(self): 1169 | return self.dm.SetLocale() 1170 | 1171 | def ReadDataToBin(self, hwnd, addr, len): 1172 | return self.dm.ReadDataToBin(hwnd, addr, len) 1173 | 1174 | def WriteDataFromBin(self, hwnd, addr, data, len): 1175 | return self.dm.WriteDataFromBin(hwnd, addr, data, len) 1176 | 1177 | def ReadDataAddrToBin(self, hwnd, addr, len): 1178 | return self.dm.ReadDataAddrToBin(hwnd, addr, len) 1179 | 1180 | def WriteDataAddrFromBin(self, hwnd, addr, data, len): 1181 | return self.dm.WriteDataAddrFromBin(hwnd, addr, data, len) 1182 | 1183 | def SetParam64ToPointer(self): 1184 | return self.dm.SetParam64ToPointer() 1185 | 1186 | def GetDPI(self): 1187 | return self.dm.GetDPI() 1188 | 1189 | def SetDisplayRefreshDelay(self, t): 1190 | return self.dm.SetDisplayRefreshDelay(t) 1191 | 1192 | def IsFolderExist(self, folder): 1193 | return self.dm.IsFolderExist(folder) 1194 | 1195 | def GetCpuType(self): 1196 | return self.dm.GetCpuType() 1197 | 1198 | def ReleaseRef(self): 1199 | return self.dm.ReleaseRef() 1200 | 1201 | def SetExitThread(self, en): 1202 | return self.dm.SetExitThread(en) 1203 | 1204 | def GetFps(self): 1205 | return self.dm.GetFps() 1206 | 1207 | def VirtualQueryEx(self, hwnd, addr, pmbi): 1208 | return self.dm.VirtualQueryEx(hwnd, addr, pmbi) 1209 | 1210 | def AsmCallEx(self, hwnd, mode, base_addr): 1211 | return self.dm.AsmCallEx(hwnd, mode, base_addr) 1212 | 1213 | def GetRemoteApiAddress(self, hwnd, base_addr, fun_name): 1214 | return self.dm.GetRemoteApiAddress(hwnd, base_addr, fun_name) 1215 | 1216 | def ExecuteCmd(self, cmd, current_dir, time_out): 1217 | return self.dm.ExecuteCmd(cmd, current_dir, time_out) 1218 | 1219 | def SpeedNormalGraphic(self, en): 1220 | return self.dm.SpeedNormalGraphic(en) 1221 | 1222 | def UnLoadDriver(self): 1223 | return self.dm.UnLoadDriver() 1224 | 1225 | def GetOsBuildNumber(self): 1226 | return self.dm.GetOsBuildNumber() 1227 | 1228 | def HackSpeed(self, rate): 1229 | return self.dm.HackSpeed(rate) 1230 | 1231 | def GetRealPath(self, path): 1232 | return self.dm.GetRealPath(path) 1233 | 1234 | def ShowTaskBarIcon(self, hwnd, is_show): 1235 | return self.dm.ShowTaskBarIcon(hwnd, is_show) 1236 | 1237 | def AsmSetTimeout(self, time_out, param): 1238 | return self.dm.AsmSetTimeout(time_out, param) 1239 | 1240 | def DmGuardParams(self, cmd, sub_cmd, param): 1241 | return self.dm.DmGuardParams(cmd, sub_cmd, param) 1242 | 1243 | def GetModuleSize(self, hwnd, module_name): 1244 | return self.dm.GetModuleSize(hwnd, module_name) 1245 | 1246 | def IsSurrpotVt(self): 1247 | return self.dm.IsSurrpotVt() 1248 | 1249 | def GetDiskModel(self, index): 1250 | return self.dm.GetDiskModel(index) 1251 | 1252 | def GetDiskReversion(self, index): 1253 | return self.dm.GetDiskReversion(index) 1254 | 1255 | def EnableFindPicMultithread(self, en): 1256 | return self.dm.EnableFindPicMultithread(en) 1257 | 1258 | def GetCpuUsage(self): 1259 | return self.dm.GetCpuUsage() 1260 | 1261 | def GetMemoryUsage(self): 1262 | return self.dm.GetMemoryUsage() 1263 | 1264 | def Hex32(self, v): 1265 | return self.dm.Hex32(v) 1266 | 1267 | def Hex64(self, v): 1268 | return self.dm.Hex64(v) 1269 | 1270 | def GetWindowThreadId(self, hwnd): 1271 | return self.dm.GetWindowThreadId(hwnd) 1272 | 1273 | def DmGuardExtract(self, type, path): 1274 | return self.dm.DmGuardExtract(type, path) 1275 | 1276 | def DmGuardLoadCustom(self, type, path): 1277 | return self.dm.DmGuardLoadCustom(type, path) 1278 | 1279 | def SetShowAsmErrorMsg(self, show): 1280 | return self.dm.SetShowAsmErrorMsg(show) 1281 | 1282 | def GetSystemInfo(self, type, method): 1283 | return self.dm.GetSystemInfo(type, method) 1284 | 1285 | def SetFindPicMultithreadCount(self, count): 1286 | return self.dm.SetFindPicMultithreadCount(count) 1287 | 1288 | def FindPicSim(self, x1, y1, x2, y2, pic_name, delta_color, sim, dir): 1289 | return self.dm.FindPicSim(x1, y1, x2, y2, pic_name, delta_color, sim, dir) 1290 | 1291 | def FindPicSimEx(self, x1, y1, x2, y2, pic_name, delta_color, sim, dir): 1292 | return self.dm.FindPicSimEx(x1, y1, x2, y2, pic_name, delta_color, sim, dir) 1293 | 1294 | def FindPicSimMem(self, x1, y1, x2, y2, pic_info, delta_color, sim, dir): 1295 | return self.dm.FindPicSimMem(x1, y1, x2, y2, pic_info, delta_color, sim, dir) 1296 | 1297 | def FindPicSimMemEx(self, x1, y1, x2, y2, pic_info, delta_color, sim, dir): 1298 | return self.dm.FindPicSimMemEx(x1, y1, x2, y2, pic_info, delta_color, sim, dir) 1299 | 1300 | def FindPicSimE(self, x1, y1, x2, y2, pic_name, delta_color, sim, dir): 1301 | return self.dm.FindPicSimE(x1, y1, x2, y2, pic_name, delta_color, sim, dir) 1302 | 1303 | def FindPicSimMemE(self, x1, y1, x2, y2, pic_info, delta_color, sim, dir): 1304 | return self.dm.FindPicSimMemE(x1, y1, x2, y2, pic_info, delta_color, sim, dir) 1305 | 1306 | def SetInputDm(self, input_dm, rx, ry): 1307 | return self.dm.SetInputDm(input_dm, rx, ry) 1308 | 1309 | 1310 | 1311 | 1312 | 1313 | if __name__ == "__main__": 1314 | m_dm = DM() 1315 | try: 1316 | print(m_dm.Reg('xxxx','xxx')) 1317 | print(m_dm.FindColor(0,0,100,100,"ffffff",0.9,0).wait_until(5)) 1318 | print(m_dm.FindColorE(0,0,100,100,"ffffff",0.9,0).wait_until(5)) 1319 | print(m_dm.FindMultiColorE(0,0,100,100,"ffffff-000000",0.9,0,0).wait_until(10)) 1320 | except TimeOutException as e: 1321 | print(e) 1322 | 1323 | -------------------------------------------------------------------------------- /readme.md: -------------------------------------------------------------------------------- 1 | # 一個使用Python封裝大漠插件的庫 2 | 3 | 這個模組是為了封裝大漠7.2213版本,並封裝了大漠插件的API,以便讓IDE都可以有代碼提示。 4 | 5 | 這些方法是從大漠插件DLL的倒出函數,生成的Python方法,因為目前沒有看到封裝比較完整python調用大漠的Libary,便有了這個。 6 | 7 | ## 安裝 8 | 9 | ```pip install pydmsoft``` 10 | 11 | ## 功能 12 | ### 初始化 13 | ``` 14 | # 已在系統註冊大漠調用 15 | dm = DM() 16 | # 使用免註冊調用 只需要在第一次調用一次即可 其餘的可直接使用 dm=DM() 17 | dm = DM(DmRegPath="path_to_dmreg.dll", DMPath="path_to_dm.dll") 18 | ``` 19 | ### 導入 20 | ```from pydmsoft import DM``` 21 | ## 使用範例 22 | 1. 註冊 23 | ``` 24 | dm = DM() 25 | result = dm.Reg(code, Ver) 26 | print(result) 27 | ``` 28 | 29 | 2. OCR 辨識 30 | ``` 31 | dm = DM() 32 | result = dm.Ocr(0, 0, 100, 100, "ffffff-000000", 0.9) 33 | print(result) 34 | ``` 35 | 36 | 3. 尋找文字 37 | ``` 38 | dm = DM() 39 | result = dm.FindStr(0, 0, 500, 500, "example", "ffffff-000000", 0.9) 40 | print(result) 41 | ``` 42 | 43 | 4. 截圖 44 | ``` 45 | dm = DM() 46 | dm.Capture(0, 0, 200, 200, "screenshot.png") 47 | ``` 48 | 49 | 5. 模擬鍵盤操作 50 | ``` 51 | dm = DM() 52 | # 按下 'A' 鍵 53 | dm.KeyPress(65) 54 | ``` 55 | 6. 部分找圖找色可使用wait_until(等待秒數,間隔) 56 | ``` 57 | try: 58 | print(m_dm.Reg('xxxx','xxx')) 59 | print(m_dm.FindColor(0,0,100,100,"ffffff",0.9,0).wait_until(5)) 60 | print(m_dm.FindColorE(0,0,100,100,"ffffff",0.9,0).wait_until(5)) 61 | print(m_dm.FindMultiColorE(0,0,100,100,"ffffff-000000",0.9,0,0).wait_until(10)) 62 | except TimeOutException as e: 63 | print(e) 64 | ``` 65 | ## 注意事項 66 | 請確保大漠的dll檔案和註冊檔案路徑正確。另外,當使用免註冊調用時,需同時提供DmRegPath和DMPath。 67 | 68 | ## 開發者資訊 69 | 70 | 這是一個開源的封裝項目,歡迎貢獻及提供建議。 -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import setuptools 2 | # 若Discription.md中有中文 須加上 encoding="utf-8" 3 | with open("readme.md", "r",encoding="utf-8") as f: 4 | long_description = f.read() 5 | 6 | setuptools.setup( 7 | name = "pydmsoft", 8 | version = "1.0.0", 9 | author = "Relaxing", 10 | author_email="bneson901203@yahoo.com.tw", 11 | description="A Simple python Wrapper for DM", 12 | long_description=long_description, 13 | long_description_content_type="text/markdown", 14 | url="https://github.com/130347665/PyDmSoft", 15 | install_requires=[ 16 | 'comtypes', 17 | 'pywin32', 18 | ], 19 | packages=setuptools.find_packages(), 20 | classifiers=[ 21 | "Programming Language :: Python :: 3", 22 | "License :: OSI Approved :: MIT License", 23 | "Operating System :: OS Independent", 24 | ], 25 | 26 | python_requires='>=3.6' 27 | ) --------------------------------------------------------------------------------