Matt Facer
Matt Facer

Reputation: 3105

windows task schedule to open a web page - vbs not working

hopefully this will be an easy one? I've got a VBS file which I am trying to schedule every week to do a XML refresh. It simply calls an ASPX page. But I cannot get the thing to work! Even when I try to double click the VBS file I just get an error message. The actual code can be found all over the place - it seems to be standard code for this purpose.

The code is (fetch.vbs)

Call LogEntry()

Sub LogEntry()

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

        'Declare variables
        Dim objRequest
        Dim URL

        Set objRequest = CreateObject("Microsoft.XMLHTTP")

        'Put together the URL link appending the Variables.
        URL = "http://mywebsite/fetchXML.aspx"

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

        'Send the HTML Request
        objRequest.Send

        'Set the object to nothing
        Set objRequest = Nothing

End Sub

The error message I get from windows (when I double click the VBS file is)

Script: fetch.vbs
Line: 1
Char: 1
Error: Invalid Character
Code: 800A0408
Source: Microsoft VBScript Compilation Error

Any ideas?!

Upvotes: 1

Views: 2042

Answers (2)

Matt Facer
Matt Facer

Reputation: 3105

Problem was solved by saving as ANSI format (not UTF-8 as default) ref: VBScript Invalid Character 800A0408 compilation error

Upvotes: 2

C0L.PAN1C
C0L.PAN1C

Reputation: 12243

it looks like it may be the encoding. especially for line 1 char 1.

Upvotes: 0

Related Questions