def drawPoniter(self, popele): """ :param popele: 接受人 :return: null """ content = str(self.msgedit.toPlainText()) # 发送内容 try: m = MoveTo() k = Thekeys() left, top, right, bottom = self.getWindow() #获取微信在屏幕的坐标 #微信搜索框 距离最最左边是100左右,距离最上面25左右 m.position = (left + 100, top + 25) m.click(Button.left, 1) time.sleep(1) #复制微信名称 并回车 k.type(popele) k.touch(Key.enter, True) time.sleep(1) #点击搜索的微信名称 m.position = (left + 100, top + 65) m.click(Button.left, 1) time.sleep(1) #复制要发送的内容 # 复制文字到输入框 m.position = (left + 345, bottom - 90) m.click(Button.left, 1) k.type(content) k.touch(Key.enter, True) time.sleep(1) #判定是否是最后一项 dataleng = len(self.dataList) - 1 if self.endface == dataleng: #关闭微信 m.position = (left + 830, top + 10) m.click(Button.left, 1) time.sleep(1) self.signal_write_msg.emit('发送完毕') except Exception as e: pass
keyboard.release('a') # press key 'Shift' keyboard.press(Key.shift) keyboard.press('b') keyboard.release('b') keyboard.press('c') keyboard.release('c') # release key 'Shift' # keyboard.release(Key.esc) keyboard.release(Key.shift) # Press down the key 'Shift' # then press other keys respectively # release 'Shift' when finishing with keyboard.pressed(Key.shift): keyboard.press('d') keyboard.release('d') keyboard.press('e') keyboard.release('e') # press the key sequence of ' python' (including leading whitespace) keyboard.type(' python') # press key whose vk=56, shift keyboard.touch(KeyCode.from_vk(56), True) keyboard.touch('a', True) keyboard.touch('a', False) # release key 'Shift' keyboard.touch(Key.shift, False)