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
Solved

wait among sendkeys

Posted on 2004-08-04
6
273 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 Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
A short article about problems I had with the new location API and permissions in Marshmallow
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…

828 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