from Basis import Admin if not Admin.isUserAdmin(): Admin.runAsAdmin() from Basis.CaptureWindow import windowsht from scipy import misc import matplotlib.pyplot as plt import numpy as np from scipy import signal ws = windowsht() ws.active_window(".*Dungeon Fighter Online.*") ws.capture_window(960,600) import cv2 import numpy as np from matplotlib import pyplot as plt img_rgb = cv2.imread('c:\\temp\\bbb.bmp') img_gray = cv2.cvtColor(img_rgb, cv2.COLOR_BGR2GRAY) template = cv2.imread('c:\\temp\\cut.bmp',0) w, h = template.shape[::-1] res = cv2.matchTemplate(img_gray,template,cv2.TM_CCOEFF_NORMED) threshold = 0.8 loc = np.where( res >= threshold) for pt in zip(*loc[::-1]):
def GameBegin(): time.sleep(5) #Indicate DFO path GamePath = "D:\Neople\DFO\NeopleLauncher.exe" subprocess.Popen(GamePath) print "1" time.sleep(15) print 2 ws = windowsht() ws.active_window(".*Dungeon Fighter Online.*") print 3 time.sleep(5) print 4 AccountPos = (1300,300) PasswordPos = (1300,333) LoginPos = (1300,366) StartPos = (1300,250) cl = ControlWindow.windowcl() cl.click(AccountPos[0],AccountPos[1]) time.sleep(0.1) cl.click(AccountPos[0],AccountPos[1]) time.sleep(0.1) cl.click(AccountPos[0],AccountPos[1]) time.sleep(3) Account = "*****@*****.**" AccountA = "5fugitive8" AccountB = "gmail.com" # cl.nomal_input(AccountA) # cl.nomal_press_down("shift",slp=1) # cl.nomal_press_keyboard("2") # cl.nomal_press_down("shift",slp=1) # cl.nomal_input(AccountB) keyboard.write(Account) time.sleep(3) cl = ControlWindow.windowcl() cl.click(PasswordPos[0],PasswordPos[1]) time.sleep(0.1) cl.click(PasswordPos[0],PasswordPos[1]) time.sleep(0.1) cl.click(PasswordPos[0],PasswordPos[1]) time.sleep(3) Password = "******" keyboard.write(Password) time.sleep(3) cl = ControlWindow.windowcl() cl.click(LoginPos[0],LoginPos[1]) time.sleep(0.1) cl.click(LoginPos[0],LoginPos[1]) time.sleep(3) cl = ControlWindow.windowcl() cl.click(StartPos[0],StartPos[1]) time.sleep(0.1) cl.click(StartPos[0],StartPos[1]) print "started"
# keyboard.release(Key.space) # # Type two upper case As # keyboard.press('A') # keyboard.release('A') # with keyboard.pressed(Key.shift): # keyboard.press('a') # keyboard.release('a') # # Type 'Hello World' using the shortcut type method # keyboard.type('Hello World') ws = windowsht() ws.active_window(".*Dungeon Fighter Online.*") # ws.active_window(".*DIEmWin.*") cl = ControlWindow.windowcl() cl.move_window(ws._handle, 0, 0) import pythoncom, pyHook def OnKeyboardEvent(event): print 'MessageName:',event.MessageName print 'Message:',event.Message print 'Time:',event.Time