Solved

wscript.sleep not working

Posted on 2004-09-14
3
274 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iSeries email authority 6 112
How to Have Macro Files Automatically "Edit" 5 79
powershell try catch  and $ErrorActionPreference = continue 6 71
VLC command 34 80
This is about my first experience with programming Arduino.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

751 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