0

I have a couple of questions about this. 1) Is there any reason WshShell.sleep Doesn't work on Windows 10? 2) What are the alternatives? They need to be compatible with Windows 7 too.

    set WshShell = CreateObject("Wscript.Shell")
    WshShell.sleep 10000

Creates the following error http://prntscr.com/86o9ml Thank you in advance.

1 Answers1

3

Wscript.Shell does not contain a sleep method. You want Wscript.Sleep.

  Wscript.sleep 10000

The Wscript object will already exist, there is no need to create it.

Community
  • 1
  • 1
shf301
  • 31,086
  • 2
  • 52
  • 86
  • 1
    Thanks! Do I need to `set WshShell = CreateObject("Wscript.Shell")` for the `WshShell.AppActivate` and `WshShell.SendKeys`? – Hunter Robertson Aug 20 '15 at 02:08
  • 1
    Yes you do. Those are all methods on the Wscript.Shell object. All of it's methods are listed here https://msdn.microsoft.com/en-us/library/ahcz2kh6(v=vs.84).aspx – shf301 Aug 21 '15 at 00:27