Solved

wait among sendkeys

Posted on 2004-08-04
6
272 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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupSum6 challenge 6 86
Scripting vs. Programming languages 25 165
I need an assist with a programming logic math question. 5 64
Cygwin - GNU GPL License 1 23
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
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 …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

786 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