473,396 Members | 1,965 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 6519
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Anks | last post by:
hi I am displaying a digital clock in an applet.I am using Thread.sleep (1000) for counting every second.This works fine some times but some times my clock just slows down or give an...
7
by: Colin Brown | last post by:
Python 2.3.3 Under Windows NT: Negative Int or Real -> sleeps for a long time Under Linux: Returns IOError: Invalid argument I consider both of these unfriendly results and expected the...
5
by: Dave | last post by:
For the life of me, I thought there was a sleep() function in the Standard Library (or something similarly named), but I can't find it. Is it non-existent or, if not, what header is it in? ...
8
by: Cider123 | last post by:
I ran into a situation where my Window Service had to process 100,000+ files, when I first noticed I needed to tweak various routines. Everything runs fine, but here's what I ran into: In the...
3
by: kiplring | last post by:
Suppose a function which has Sleep() method in it. And I want to recycle it. I made two buttons which call "Resume()" and "Suspend()". But It doesn't work. The state of thread "t" will be...
14
by: Joe | last post by:
Does anyone know the difference, in practical terms, between Thread.Sleep (10000) and Thread.CurrentThread.Join (10000)?? The MSDN says that with Join, standard COM and SendMessage pumping...
2
by: andychambers2002 | last post by:
I've written a simple Timer class that allows you to extend it and then implement onMinuteChange, onHourChange etc methods which will be executed on each new minute/hour respectively. It works...
1
by: Matt Brown - identify | last post by:
Hello, I, as well as suspecting many others, am having an issue when I attempt to enter sleep mode in Vista. If any program is connected to the internet (AOL Instant Messenger for instance),...
13
by: Charles Zhang | last post by:
Sleep() function Sleep at lease 1 millisecond, there is a way to make a thread to sleep less than a millisecond? One way I know of is using performance counter which is not really sleep ( loop and...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.