import time from pymouse import PyMouse from pykeyboard import PyKeyboard import re import win32clipboard as clip import win32con as con m = PyMouse() k = PyKeyboard() def set_clip(msg): if isinstance(msg, str): msg = msg.decode('utf-8') clip.OpenClipboard() clip.EmptyClipboard() clip.SetClipboardData(con.CF_UNICODETEXT, msg) clip.CloseClipboard() def ctrl_v(): k.press_keys([k.control_key, 'v']) def ctrl_a(): k.press_keys([k.control_key, 'a']) def read_data(file_name): if not re.findall(".txt", file_name): file_name = file_name + ".txt" list_name = [] with open(file_name) as r: for d in r: list_name.append(d.strip()) return list_name def paste_to(message, position_x, position_y): time.sleep(0.5) set_clip(message) m.click(position_x, position_y) ctrl_a() ctrl_v() time.sleep(1)