469,267 Members | 1,113 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,267 developers. It's quick & easy.

sleep methods in vb.net

In a vbscript making something sleep is as easy as this....
Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep 5000

In .net I've got the object created. I know it works because I use it else
where.
Set WshShell = CreateObject("WScript.Shell")

How do I implement the sleep method?

What I'm doing is using the WshShell to run/open the remote assistance help
page, and then I use SendKeys to populate the pc name field, however I need
a delay before the sendkeys call since depending on the pc, the remote
assistacne page may take a sec or two to open. So if you sendkeys before
the app is ready the key strokes wont get there.

Thanks

Nov 21 '05 #1
4 6327
Jason wrote:
How do I implement the sleep method?


I'd use the .NET Thread.Sleep() method instead of using WScript. Try this:

\\\
Threading.Thread.CurrentThread.Sleep(5000)
///

Hope that helps,

--

(O) e n o n e
Nov 21 '05 #2
"Jason" <so*****@somewhere.com> schrieb:
however I need
a delay before the sendkeys call since depending on the pc, the remote
assistacne page may take a sec or two to open.


\\\
Imports System.Threading
..
..
..
Thread.Sleep(1000)
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 21 '05 #3
In article <#r**************@TK2MSFTNGP10.phx.gbl>, Jason wrote:
In a vbscript making something sleep is as easy as this....
Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep 5000

In .net I've got the object created. I know it works because I use it else
where.
Set WshShell = CreateObject("WScript.Shell")

How do I implement the sleep method?

What I'm doing is using the WshShell to run/open the remote assistance help
page, and then I use SendKeys to populate the pc name field, however I need
a delay before the sendkeys call since depending on the pc, the remote
assistacne page may take a sec or two to open. So if you sendkeys before
the app is ready the key strokes wont get there.

Thanks


You can as, the other posters indicated use
System.Threading.Thread.Sleep.

I'm wondering though, if it might not be possilbe to launch this using
the System.Diagnostics.Process class... If you could, then you would be
able to use the process instance method, WaitForInputIdle - which
basically, waits until the launched process is ready to begin accepting
input.

--
Tom Shelton [MVP]
Nov 21 '05 #4
Jason,

In addition to Tom, can you not use the standardoutput member to get the
output from the process. (even if it is the end).

I hope this helps,

Cor
Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Anks | last post: by
7 posts views Thread by Colin Brown | last post: by
5 posts views Thread by Dave | last post: by
8 posts views Thread by Cider123 | last post: by
14 posts views Thread by Joe | last post: by
2 posts views Thread by andychambers2002 | last post: by
13 posts views Thread by Charles Zhang | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.