Solved

Sendkeys is waiting for the delay

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

863 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

23 Experts available now in Live!

Get 1:1 Help Now