Solved

wscript.sleep not working

Posted on 2004-09-14
3
271 Views
Last Modified: 2011-10-03
Can someone tell me whats up with this code, please?  Everytime I try to debug this it says that line 4 has a error and the error description is "Object required (WScript) - Sleep

Dim sh
Set sh = WScript.CreateObject("WScript.shell")
sh.Run "runas /user:local administrator ""manage1.msc"""
WScript.Sleep(5000)
sh.SendKeys "password~"
WScript.Quit
0
Comment
Question by:jcredle
  • 2
3 Comments
 
LVL 3

Expert Comment

by:KeithWatson
ID: 12059558
This works for me, at least, without the third line, but the sleep call works on XP. I don't suppose it could be as simple as getting rid of the brackets? So, WScript.Sleep 5000. Also, I take it you are running this as a .vbs file?
0
 

Author Comment

by:jcredle
ID: 12064521
Yes, I am using this as a .vbs file.  I tried to run the script without the brackets also.
0
 
LVL 3

Accepted Solution

by:
KeithWatson earned 50 total points
ID: 12083543
Does WScript.sleep(5000) work if you just run it on its own in a script? I don't really know what the problem is, but I guess if you eliminate the possibilities. It may be that the interpreter is being thrown by something being wrong in the previous line of script.
0

Featured Post

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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
A short article about a problem I had getting the GPS LocationListener working.

679 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