pause in script

  • Thread starter Thread starter Joel Allen
  • Start date Start date
J

Joel Allen

Hello,

I just want to add a 5 second pause in my script. Can someone point me to
some sample code - I couldn't find the command?

Thank you,
Joel
 
Am Thu, 23 Feb 2006 07:38:11 -0800 schrieb Joel Allen:

Joel, one method would be to use the Sleep API but that stops not your
function, but the whole thread the function is running in.

Another approach is to split your code and use the timer API, summary:

sub f1()
' execute first part
' if the first part is ready call the timer
end function

sub timer_callback()
' method called by the timer after 5 seconds e.g.
' call f2 now
end sub

sub f2()
' execute the rest here
end sub

Sample (with German comments):
http://www.vboffice.net/sample.html?mnu=2&smp=4&cmd=showitem

If you use that timer you need to ensure that the timer is really stopped
before Outlook closes! (In the scenario above no problem, simply stop the
timer before calling f2.)
 
I just want to add a 5 second pause in my script. Can someone point me to
some sample code - I couldn't find the command?

This is what I use:
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
and then
Sleep 5000 ' Sleep 5 seconds
 
Although if this is truly script code (VBScript) none of the Win32 API calls
can be used.
 
Although if this is truly script code (VBScript) none of the Win32 API calls
can be used.

I pondered that, too. But the name of this newsgroup is
microsoft.public.outlook.program_vba and the original message wasn't
crossposted, so I thought it might help.
 
I am in the Script Editor of my custom task form. Not sure if thats VB
script or not.

Thanks,
Joel
 
Am Sun, 26 Feb 2006 19:46:04 GMT schrieb Joel Allen:

Then that´s VBScript and you can´t use Win32 API calls as Ken mentioned.

The WSH has a sleep method that you can use.
 
Back
Top