在 2005年7月16日星期六 UTC+8下午8:46:34,Benji York写道:
> googlegro...@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.Send
On Saturday, July 16, 2005 at 2:46:34 PM UTC+2, Benji York wrote:
> googlegro...@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 Pro
Thank you, Peter.
The application is a <<>> and
we want to automatically interact with it (e.g. sendkeys and capture
certain text responses).
I will look for the thread you mentioned.
- Roy
--
http://mail.python.org/mailman/listinfo/python-list
RTG wrote:
> With this capability, other possibilities open up.
> Is there a way to read the output from the from the console window?
> For example, how can we capture the output of the dir command?
Normally one does that using a call to things like os.popen, or using
the new subprocess module.
Benji,
This appears to be exactly what we need.
I also see that by changing "Command Prompt" to "Notepad" or another
application, the key strokes are sent there.
With this capability, other possibilities open up.
Is there a way to read the output from the from the console window?
For example, how
[EMAIL PROTECTED] wrote:
> This gives me hope, but what I really need to do is to send keystrokes
> to an <<>> console window.
That's exactly what the code does. Try it out, you'll see how it works
quickly enough.
--
Benji York
--
http://mail.python.org/mailman/listinfo/python-list
Thank you, Benji.
This gives me hope, but what I really need to do is to send keystrokes
to an <<>> console window.
Any help there?
(P.S. Sorry that I wasn't more specific.)
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] 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 Th
How do I use Python to send keystrokes to a console window in Windows
XP?
Or perhaps there is an application that I can call to do this?
Thank you for your help.
--
http://mail.python.org/mailman/listinfo/python-list