1

I'm getting this compilation error with a script I was working on using WScript.SendKeys. Yes, I have saved the .vbs file to be encoded as ANSI. It says the error is on Line 48, which is this:

shell.SendKeys {ENTER}

The rest of the script works just fine if I take this line out, in case that's important.

  • 1
    SendKeys wants a String argument use shell.SendKeys "{ENTER}". { and } are invalid characters that's what the error is. – engineersmnky Jun 03 '15 at 23:44

1 Answers1

3

You need to enclose {ENTER} in quotes. SendKeys expects a string parameter.

shell.SendKeys "{ENTER}"
Bond
  • 16,071
  • 6
  • 30
  • 53
  • That worked perfectly, thanks! I probably looked over that since I used a variable with sendkeys one line previously. – Generic Name Jun 03 '15 at 23:48
  • 2
    @GenericName ==> In this case you must accept this answer ! So take a look at this http://stackoverflow.com/tour – Hackoo Jun 04 '15 at 03:29