|
-
Aug 19th, 2006, 04:50 PM
#1
Thread Starter
PowerPoster
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");
-
Aug 19th, 2006, 07:40 PM
#2
Hyperactive Member
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.
-
Aug 19th, 2006, 08:22 PM
#3
Thread Starter
PowerPoster
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
-
Aug 19th, 2006, 08:50 PM
#4
Hyperactive Member
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
-
Aug 19th, 2006, 10:31 PM
#5
Thread Starter
PowerPoster
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.
-
Aug 19th, 2006, 11:35 PM
#6
Thread Starter
PowerPoster
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.
-
Aug 20th, 2006, 06:18 PM
#7
Hyperactive Member
Re: SendKeys help
Thanks, I think I understand what you're trying to do.
Jennifer
-
Aug 20th, 2006, 06:23 PM
#8
Thread Starter
PowerPoster
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|