Solved

wait among sendkeys

Posted on 2004-08-04
6
270 Views
Last Modified: 2008-02-26
My code is as follows.. Please insert the wait after the sendkeys I have specified.. I have tried my level best but unable to get the results..

'**************************************

ReturnValue = Shell("myapplication.exe", 1)
AppActivate ReturnValue

Name1 = "Trial" & Number & ".prd"
Name2 = "Trial" & Number & ".csv"

SendKeys "%{s}" & "{right}" & "{right}" & "O", True
SendKeys Name1 & "{TAB}" & "{TAB}" & "{ENTER}", True

SendKeys "%{o}" & "R" & "D" & "{ENTER}", True

?????????????want to wait here for twelve seconds



SendKeys "%{F}~", True
SendKeys Name2 & "{enter}", True

?????????????want to wait here for twelve seconds

If wells <> 0 Then
SendKeys "{left}" & "{left}", True
SendKeys "{tab}" & "{tab}" & "{tab}" & "{tab}" & "{tab}" & "{tab}" & "{tab}" & "{tab}" & "{tab}" & "{tab}" & "{tab}" & "{tab}" & "{tab}" & "{tab}", True

?????????????want to wait here for twelve seconds


For i = 1 To wells
   
SendKeys "{down}", True
SendKeys "%{F}~", True
SendKeys "w" & i & Name2 & "{enter}", True

?????????????want to wait here for twelve seconds


Next i

End If


SendKeys "%{F}" & "E" & "{enter}", True     ' closing application
SendKeys "%{f}" & "X", True
SendKeys "{ESCAPE}", True


Thank you.

0
Comment
Question by:Aiysha
6 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 11720907
Use WinApi Sleep function


Sleep 300 ' wait for 300 milliseconds
0
 

Author Comment

by:Aiysha
ID: 11721211
No, it didnt work... I guess there is no practical way of using waitcommand in sendkey mode.. This help me though..

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/VB_Controls/Q_20550601.html?query=sleep%2C+sendkey&clearTAFilter=true

Very dirty way, but it helped.. Sorry jaime_olivares.. but thanx for trying..


Moderator, Please delete this question.

Thank you.
0
 
LVL 22

Expert Comment

by:cookre
ID: 11721304
One presumes you did a Sleep 12000.

Note that Sleep stop the calling process.  It's not just a local idle loop - all message processing is stopped, too.  The linked example probably failed because he was send ing keys to himself and not an independent app.
0
 
LVL 3

Expert Comment

by:bigjim2000
ID: 11808341
Are you using .NET?

If so, then you can use the System.Windows.Forms.SendKeys.SendWait(string) method.  This sends the keys as normal, but also waits for the key messages to get processed before continuing.

-Eric
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 12036235
PAQed, with points refunded (500)

Computer101
E-E Admin
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

This article will show, step by step, how to integrate R code into a R Sweave document
A short article about a problem I had getting the GPS LocationListener working.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

708 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

19 Experts available now in Live!

Get 1:1 Help Now