Solved

wscript.sleep not working

Posted on 2004-09-14
3
265 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
hasOne  challenge 59 91
firstChar challenge 13 84
python sqlite question 11 43
advertisement module in core php 4 88
This article will show, step by step, how to integrate R code into a R Sweave document
This is an explanation of a simple data model to help parse a JSON feed
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now