How do I send keystrokes to a console window in Windows XP?
jglobocnik37 at gmail.com
jglobocnik37 at gmail.com
Tue Nov 28 03:14:17 EST 2017
On Saturday, July 16, 2005 at 2:46:34 PM UTC+2, Benji York wrote:
> GoogleGroups at garringer.net wrote:
> > How do I use Python to send keystrokes to a console window in Windows
> > XP?
>
> import win32com.client
>
> shell = win32com.client.Dispatch("WScript.Shell")
> shell.AppActivate("Command Prompt")
>
> shell.SendKeys("cls{ENTER}")
> shell.SendKeys("dir{ENTER}")
> shell.SendKeys("echo Hi There{ENTER}")
> --
> Benji York
Hey!
Do you have any idea on how to open 2 command panels at the same time and that every command would write to 1 command panel and other command to 2 command panel, when i tried to do something like this:
shell.run("cmd")
shell2.run("cmd")
shell.AppActivate("cmd")
time.sleep(5)
shell.SendKeys('ffmpeg -y -f dshow -i video="Logitech HD Webcam C270" kamera'+datestring+'.mp4')
shell2.SendKeys("xxxccccccccccccc{ENTER}")
time.sleep(1)
shell.SendKeys("{ENTER}")
time.sleep(2)
ffmpeg -y -f dshow -i ffmpeg -y -f dshow -i video="Logitech HD Webcam C270" kamera.mp4video="Logitech HD Webcam C270" kamera.mp4
shell.SendKeys('^c')
time.sleep(2)
shell.SendKeys('exit')
time.sleep(1)
shell.SendKeys("{ENTER}")'''
everything gets in random places
More information about the Python-list
mailing list