By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,326 Members | 838 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,326 IT Pros & Developers. It's quick & easy.

sleep methods in vb.net

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
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

P: n/a
"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

P: n/a
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

P: n/a
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.