尝试使用在线编译器编译脚本时出现错误“30203 标识符预期错误”

Cha*_*biz 7 vbscript

我试图让这个脚本在 Windows 上作为计划任务运行,使用在线编译器进行检查,消息 VBNC30203 标识符错误被突出显示,我已查看此消息,但没有实施修复的技能,任何帮助受到赞赏。

脚本的来源是:

http://www.642weather.com/weather/wxblog/php-scripts/scheduled-http-request-windows-task-scheduler/

我只是在脚本中输入了我的 URL/文件名。

这是我的VBS代码:

Call LogEntry()

Sub LogEntry()

'Force the script to finish on an error.
On Error Resume Next

'Declare variables
Dim objRequest
Dim URL

'The URL link.
URL = "http://www.chatteris.biz/forecast-compare-include.php?log&config=am"

Set objRequest = CreateObject("Microsoft.XMLHTTP")

'Open the HTTP request and pass the URL to the objRequest object
objRequest.open "GET", URL , false

'Send the HTML Request
objRequest.Send

'Set the object to nothing
Set objRequest = Nothing

End Sub
Run Code Online (Sandbox Code Playgroud)

Mer*_*ury 4

通常在在线编译器(例如tutorialspoint在线编译器)中,您应该在Module VBModule范围内编写代码,并且需要Sub Main()。

像这样写你的代码:

Module VBModule

  Sub Main()
      ' Your code goes here
  End Sub

  ' Your functions / subs goes here

End Module
Run Code Online (Sandbox Code Playgroud)