Solved

Sendkeys is waiting for the delay

Posted on 2008-10-22
4
1,177 Views
Last Modified: 2008-11-22
Hi, I'm using sendkeys to send 3 commands to a window.  The first sendkeys is sending a string which it is doing.  The 2nd send keys is sending the ENTER key which it is doing and finally the 3rd send keys is sending another string.  The problem is that the second sleep is not kicking in, so passes it the 1st string and then waits for 2 secs and then it passes the ENTER key and the 3rd string together.  I really can't see what the problem is.  Anyone that can help feel free to shout.
SendKeys.Send("A6UJ9A000R08")
System.Threading.Thread.Sleep(2000)
SendKeys.Send("{ENTER}")
System.Threading.Thread.Sleep(2000)
SendKeys.Send("TEST")

Open in new window

0
Comment
Question by:meteorelec
4 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
ID: 22780797
You could try SendWait() instead of Send():
http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.sendwait.aspx

SendKeys. SendWait("A6UJ9A000R08")
System.Threading.Thread.Sleep(2000)
SendKeys. SendWait("{ENTER}")
System.Threading.Thread.Sleep(2000)
SendKeys. SendWait("TEST")

Open in new window

0
 
LVL 2

Author Comment

by:meteorelec
ID: 22783990
That worked brilliantly, once again thanks a million Idle Mind.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Introduction When many people think of the WebBrowser (http://msdn.microsoft.com/en-us/library/2te2y1x6%28v=VS.85%29.aspx) control, they immediately think of a control which allows the viewing and navigation of web pages. While this is true, it's a…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question