VBS脚本错误 - “预期声明” - 检查错误

时间:2018-02-21 22:27:33

标签: vbscript

我是新来的,如果我错了,请原谅我。我在这里使用此代码,我正在获取

  

预期声明 - 第3行字符1

代码:

Set wshShell =wscript.CreateObject("WScript.Shell")
dowscript.sleep100wshShell.sendkeys
"{CAPSLOCK}"wshshell.sendkeys
"{NUMLOCK}"wshshell.sendkeys "{SCROLLLOCK}"
loop

有什么想法吗?

编辑:当尝试将该代码放在如下所示的现有循环中时,我得到无效的字符行1 char 1

Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set colCDROMs = oWMP.cdromCollection
if colCDROMs.Count >= 1 then
do
For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject
Next ' cdrom
For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject
Next ' cdrom
loop
End If
Set wshShell = WScript.CreateObject("WScript.Shell")
Do
  WScript.Sleep 100
  wshShell.Sendkeys "{CAPSLOCK}"
  wshshell.Sendkeys "{NUMLOCK}"
  wshshell.Sendkeys "{SCROLLLOCK}"

0 个答案:

没有答案