Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Sendkeys is waiting for the delay

Posted on 2008-10-22
4
Medium Priority
?
1,239 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

722 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