How to insert some string into active window in Python?

Possible duplicate:
How to copy a string to the clipboard in Windows using Python?

Can someone give me an example or explain to me how I can insert something into the active window using Python?

I edited because I did not know that pasting to the clipboard is not pasting into the active window ...

+3
source share
1 answer

since you did not accept the duplicate as an answer, I can suggest:

import win32com.client
shell = win32com.client.Dispatch("WScript.Shell")
shell.SendKeys('keys to send to active window...')

from

here

and if you need to know about keys like Backspace, go to

here

+3
source

Source: https://habr.com/ru/post/1750176/


All Articles