asweigart / pyautogui

A cross-platform GUI automation Python module for human beings. Used to programmatically control the mouse & keyboard.
BSD 3-Clause "New" or "Revised" License
10.06k stars 1.22k forks source link

Supporting typewrite other languages (Chinese) #237

Open qzcool opened 6 years ago

qzcool commented 6 years ago
import pyperclip

content = '我爱北京天安门'

pyperclip.copy(content)
time.sleep(0.5)
pyautogui.hotkey('ctrl', 'v')

Currently I use PyPerClip module to handle typewriting other languages like Chinese, by any chance that we could come up with an official support to other languages with auto-detection, as PyAutoGUI is greatly loved everywhere?

pyautogui.typewrite('我爱北京天安门', interval = 0.1, language = auto_detected)
lOmarBl commented 2 years ago

@qzcool I don't know how it's been 4 years yet nobody said this before me, but you are a genius. Such a simple yet effective solution. Thank you! :)

pjgao commented 1 year ago

Pyperclip use clipboard to paste, typewrite use keyboard to write text however.

fanxiaoyu0 commented 1 month ago

You are a genius! Even after 6 years, this remains a simple and effective solution. A great approach that got my brain spinning. Love from China.