Solved

wscript.sleep not working

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

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.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

803 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