Solved

Sendkeys is waiting for the delay

Posted on 2008-10-22
4
1,147 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now