How can I send keypresses to a running process object?
Posted
by Waffles
on Stack Overflow
See other posts from Stack Overflow
or by Waffles
Published on 2010-04-21T22:02:01Z
Indexed on
2010/04/21
22:33 UTC
Read the original article
Hit count: 175
I am trying to make C# launch an application (in this case open office), and start sending that application keypresses such that it would appear as though someone is typing. So ideally, I would be able to send a running open office process the keypress for the letter "d", and open office would then type d on the paper. Can anyone give me direction as per how to go about this? I have tried to do the following:
p = new Process();
p.StartInfo.UseShellExecute = true;
p.StartInfo.CreateNoWindow = false;
p.StartInfo.FileName = processNames.executableName;
p.Start();
p.StandardInput.Write("hello");
But that doesn't get me the desired effect - I don't see the text typed out in open office.
© Stack Overflow or respective owner