def test(self): app = application.Application() app.connect(title_re="1С:Предприятие") app_1c = app['1С:Предприятие - Торговля+Склад, редакция 9.2'] # app_1c.menu_select("ВСД -> ВСД_Партии") # app_1c.child_window(title="Справочник: ВСД_Партия").print_control_identifiers() p1 = app_1c.child_window(title="Справочник: ВСД_Партия").child_window( class_name="browse") p1.set_focus() left, top = get_pos(p1, 30) mouse.double_click(coords=(left, top)) app_1c.child_window(title='Обновить из Меркурия').click() send_keys('{ENTER}') w1 = app_1c.child_window(title="Окно сообщений") w1.set_focus() left, top = get_center(w1, 10) mouse.click(coords=(left, top)) print("Клик = ", left, top) mouse.click(coords=(left, top)) # time.sleep(0.2) send_keys('^{HOME}') time.sleep(0.2) send_keys('+^{END}') send_keys('^{INSERT}') data = clipboard.GetData() s = data.split('\n') # print(s[-2]) # print(s[-1]) # self.assertEqual(s[-2], 'Результат = COMPLETED\r') self.assertIn('Результат = COMPLETED\r', s)
def double_tap(self, pos, button='left'): if button not in ("left", "right", "middle"): raise ValueError("Unknow button: " + button) pos = list(pos) pos[0] = pos[0] + self.monitor["left"] pos[1] = pos[1] + self.monitor["top"] mouse.double_click(button=button, coords=pos)
def clearmonster(self): listitems = self.monsterlist.get_items() x = listitems[0].rectangle().left x = x + 5 y = listitems[0].rectangle().top y = y + 5 for i in range(3): mouse.double_click(coords=(x, y))
def clearpoint(self): listitems = self.pointlist.get_items() x = listitems[0].rectangle().left x = x + 5 y = listitems[0].rectangle().top y = y + 5 for i in range(len(listitems)): mouse.double_click(coords=(x, y))
def double_tap(self, pos, button='left'): set_foreground_window(self.window) if button not in ("left", "right", "middle"): raise ValueError("Unknow button: " + button) pos = list(pos) pos[0] = pos[0] + self.monitor["left"] pos[1] = pos[1] + self.monitor["top"] pos = tuple(pos) coords = get_action_pos(self.window, pos) mouse.double_click(button=button, coords=coords)
def user_double_click(text): time.sleep(0.5) img = PIL.ImageGrab.grab() #imgplot = plt.imshow(img) data = pytesseract.image_to_data(img) data = data.split() #print(data) draw = ImageDraw.Draw(img) coords_list = [] count = 1 '''for i in range(len(data)): if ' '.join(text) in data[i].lower(): print("Match Found") #coord_x = int(data[i-5]) + int(data[i-3]/2) #coord_y = int(data[i-4]) + int(data[i-2]/2) coord_x = int(data[i-5]) + int(int(data[i-3])/2) coord_y = int(data[i-4]) + int(int(data[i-2])/2) mouse.double_click(button="left",coords=(coord_x,coord_y)) print("Double Clicked at: (" ,coord_x,",", coord_y,")") break''' for i in range(len(data)): if ' '.join(text) in data[i].lower(): print("Match Found") coord_x = int(data[i - 5]) + int(int(data[i - 3]) / 2) coord_y = int(data[i - 4]) + int(int(data[i - 2]) / 2) draw.text((coord_x, coord_y), str(count), fill="rgb(240,0,0)", font=font) coords_list.append((coord_x, coord_y)) count += 1 #if count>2: img.show() img.save("./images/image.png") winsound.Beep(frequency, duration) # if voice_cmd: im_no = str(speech.press_record()) # else: # im_no = int(input("Enter The number of image to select: ")) # time.sleep(2) #print(im_no) SendKeys("%{F4}") time.sleep(1) mouse.double_click(button='left', coords=(coords_list[int(im_no) - 1]))
import time # 选择单元结构 # time.sleep(5) # k = PyKeyboard() # k.press_key(k.shift_key) # # # 鼠标长按 # mouse.press(coords=(345,167)) # # time.sleep(2) # # # 释放鼠标位置 # mouse.release(coords=(1488,727)) # # k.release_key(k.shift_key) send_keys('{ENTER}') # 使用Ctrl+A ,Ctrl+C # 鼠标点击操作,可以修改coords来指定点击位置 mouse.click(button='left', coords=(0, 0)) # 鼠标双击操作,可以修改coords来指定双击位置 mouse.double_click(button='left', coords=(0, 0)) # 移动鼠标,可以修改coords使鼠标移动到指定位置 mouse.move(coords=(0, 0)) # 鼠标右键点击,可以修改coords来指定右键点击位置 mouse.right_click(coords=(0, 0)) # 鼠标滚动操作,可以修改coords来指定滚动位置,修改wheel_dist来指定滚动距离 mouse.scroll(coords=(0, 0), wheel_dist=1)
def ths_start(): mouse.double_click(coords=(40, 40)) time.sleep(20) mouse.click(coords=(1, 1))
def test_double_click(self): mouse.double_click(coords=(self.__get_pos(50))) data = self.__get_text() self.assertTrue("Mouse DoubleClick" in data)
def dclick(x, y): Event.mouse_move(x, y) mouse.double_click(button='left', coords=(x, y))
def test_double_click(self): mouse.double_click(coords=(self.__get_pos(50))) data = self.__get_text() self.assertTrue("Mouse DoubleClick" in data)
def mouse_double_click(self): mouse.double_click("left")
# @Author : Philly # @File : cgjy2.py # @Description: from pywinauto.application import Application from pywinauto import mouse, keyboard from time import sleep # Run a target application app = Application(backend="uia").start( r"E:\云康\康华\Release集群\DaanWinApp.exe") # 启动程序 sleep(2) mouse.click(button="left", coords=(963, 554)) # 点击确定缺少配置文件提示 sleep(1) # 双击账号并取消文本 mouse.double_click(button="left", coords=(925, 567)) keyboard.SendKeys('{BACKSPACE}') # 键盘 BACKSPACE keyboard.SendKeys('admingltest') # 输入账号 sleep(1) keyboard.SendKeys('{TAB}') # TAB keyboard.SendKeys('{BACKSPACE}') # 键盘 BACKSPACE keyboard.SendKeys('123abc') # 输入密码 sleep(1) 2 mouse.click(button="left", coords=(979, 684)) # 点击登录 sleep(3) app = app.connect( title_re="康华检验平台", class_name="WindowsForms10.Window.8.app.0.2eed1ca_r9_ad1") # 连接到现运行程序 # print(app["康华检验平台"].print_control_identifiers()) # 显示窗口的子窗口、控件等