?
Solved

Delay an application

Posted on 2003-03-14
6
Medium Priority
?
472 Views
Last Modified: 2013-12-26
Hi!

I need to remote SAP by using the sendkey command. Since SAP needs some time to get the specified data - I need to create a pause before I can continue sending the other keys... Can you tell me how I can do that? I don't think it's difficult but I just don't get it at the moment...
0
Comment
Question by:Venio
[X]
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
  • 3
  • 2
6 Comments
 
LVL 43

Expert Comment

by:TimCottee
ID: 8135172
Hi Venio,

There is an api call which is best suited to this task:

Private Declare Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)

Then when you want to wait:

Sleep 5000 'Wait for 5 seconds

Tim Cottee MCSD, MCDBA, CPIM
http://www.timcottee.tk 

Brainbench MVP for Visual Basic
http://www.brainbench.com

Experts-Exchange Advisory Board Member
0
 

Author Comment

by:Venio
ID: 8135185
I've tried sleep before but it didn't work... I have added the Source Code... maybe I've done something wrong (I'm totally new to VB)

Private Sub Command2_Click()
Dim i, j As Long
SendKeys "%{tab}"
For i = 0 To (List1.ListCount - 1)
    SendKeys "{Tab}"
    SendKeys "{Tab}"
    SendKeys List1.List(i)
    SendKeys "{F8}"
    Sleep (1000)
    SendKeys "~"
    SendKeys "^(+{F7})"
Next
End Sub
0
 
LVL 1

Accepted Solution

by:
Ysgrathe earned 200 total points
ID: 8135238
Venio,
if you just want vb to waste a little time you could set up a little time wasting loop...

before the flames start coming in, i know it isnt efficient useage of processor time, etc, but it works in appropriate situations where the client pc just has to wait for a short time for a network based process to catch up and the client doesnt have too much else to do in the mean time, and is totally VB.

Private Sub WasteTime(intSeconds as integer)
Dim x As Date
x = DateAdd("s", intSeconds , Now())

While Now() < x
    DoEvents
Wend

End Sub

its quick, its dirty, but it works.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:Venio
ID: 8135650
das hat mir geholfen! Vielen Dank!
0
 
LVL 1

Expert Comment

by:Ysgrathe
ID: 8142346
Sie sind willkommen.
0
 

Author Comment

by:Venio
ID: 8150169
;-) now it's out: I'm from Germany...
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

800 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