-
SendKeys help
im trying to write a simple automation system which does the following:
get a string data (easy)
click a textbox (easy)
SendKey(string data) - problems
now, the problem I am having is that when I am sending keys, say the text is:
"hi how are you"
sometimes it displays it just like that, most of the time it does this:
hii hooowwwww arrrreeeee yooouuuu
any ideas why?
code:
SendKeys.Send("hi how are you");
-
Re: SendKeys help
I dont know if i dont understand what you're asking, but doesnt SendKeys provide an automated way of sending keystrokes to an application?
fOr e.g. SendKeys.Send("{ESC}");
is the same as if the user pressed the escape key.
-
Re: SendKeys help
yes I am aware of that.
however I've resolved the issue now. Had to add a bit of a time delay
-
Re: SendKeys help
Could you post your code, i'm always interested in learning new things. I still dont think i fully understand your question.
Jennifer
-
Re: SendKeys help
code is pretty simple,
for (int counter = 0; counter < 10; counter++)
{
Clipboard.SetText("hi how are you");
SendKeys.SendWait("^(v)");
Thread.Sleep(300);
Clipboard.Clear();
}
how ever it still does the thing im complaining about.
-
Re: SendKeys help
ok well now after some time (using the same code), it just pastes like several times sometimes and others just as it is meant to.
all I want to do is paste once in a different position - I am of course setting the position to another textbox but when i execute the paste command key, as above, sometimes it just pastes the text several times.
-
Re: SendKeys help
Thanks, I think I understand what you're trying to do.
Jennifer
-
Re: SendKeys help
i think its almost resolved now, had to really tell it how many keystrokes/times it should send those keystroke:
Sendkeys.SendWait("^{v 1}");
meaning press the CTRL and v key, once