ASP - Scheduling an ASP page to run in task manager

Asked By Karen Puehn on 26-Nov-01 12:33 PM
I used the samplecode associated with linkid=139 but replaced the sURL with my asp url plus username and pwd which I tested in IE, however,  it does not appear to work via the vbs file.

The vbs file is sitting in the same directory as the asp page.  The asp page does create, write and close a file.


Help troubleshooting would be greatly appreciated.


scheduletest.asp :
<%@ LANGUAGE="VBSCRIPT" %>
<%
dim objFMR_FSO,objFMRTS 
set objFMR_FSO = CreateObject ("Scripting.FileSystemObject")
dim testfile


testfile="c:\inetpub\wwwroot\formstracking_monthly\asp\pdfreports\test.txt"
if not objFMR_FSO.FileExists(testfile) then
  set objFMRTS=objFMR_FSO.CreateTextFile(testfile)
else
  set objFMRTS=objFMR_FSO.OpenTextFile(testfile,ForAppending)

end if

 objFMRTS.WriteLine("test test")
 objFMRTS.Close
 
  set objFMR_FSO = Nothing
  set objFMRTS = Nothing


%>
  test.vbs:
Sub MyASPJob

  Dim oXMLHttp
  Dim sURL

     on error resume next

     Set oXMLHttp = CreateObject("MSXML2.XMLHTTP.3.0")
     ' sURL="http://usr:pwd@url/formstracking_monthly/asp/scheduletest.asp"
   
    oXMLHttp.open "GET", sURL, false 
       oXMLHttp.send()                   

          if oXMLHttp.status = 200 Then   
             ' Retrieve enter HTML response 
             MsgBox oXMLHttp.ResponseText 
          else 
             ' Failed 
          end if 
     
    Set oXMLHttp = nothing 

End Sub 

Call MyASPJob()

forAppending is not a built-in constant - Asked By Peter Bromberg on 26-Nov-01 05:21 PM

You need to define it with:

const ForAppending=8

--at the top of your script. Here are the values:

Settings
The iomode argument can have any of the following settings:

Constant Value Description 
ForReading 1 Open a file for reading only. You can't write to this file. 
ForWriting 2 Open a file for writing. 
ForAppending 8 Open a file and write to the end of the file. 

The format argument can have any of the following settings:

Value Description 
TristateTrue Open the file as Unicode. 
TristateFalse Open the file as ASCII. 
TristateUseDefault Open the file using the system default.

still unable to schedule - Asked By Karen Puehn on 10-Dec-01 08:06 PM

task schedule log entry:
"testscript.job" (testscript.vbs)
	Started 12/10/2001 8:01:09 PM
"testscript.job" (testscript.vbs)
	Finished 12/10/2001 8:01:09 PM
	Result: The task completed with an exit code of (0).
[ **

example test.asp :
<% @LANGUAGE="VBSCRIPT" %>
<%
Const ForAppending = 8
dim objFMR_FSO,objFMRTS
set objFMR_FSO=CreateObject("scripting.FileSystemObject")
dim testfile

testfile="c:\inetpub\wwwroot\test\test.log"
if not objFMR_FSO.FileExists(testfile) then
  Response.Write("does not exist")
  set objFMRTS=objFMR_FSO.CreateTextFile(testfile)
else
  Response.Write("does exist")
  set objFMRTS=objFMR_FSO.OpenTextFile(testfile,ForAppending)
end if

objFMRTS.WriteLine("test test")
objFMRTS.Close

set objFMR_FSO=Nothing
set objFMRTS=Nothing

%> 

example test.vbs:
Sub MYASPJob

dim oXMLHttp
dim sURL

on error resume next

Set oXMLHttp = CreateObject("MSXML2.XMLHTTP.3.0")
sURL="http://localhost/test/test.asp"

oXMLHttp.open "GET", sURL, false
  oXMLHttp.send()
if oXMLHttp.status = 200 then
   'retrieve enter HTML response
  MSGBox oXMLHttp.ResponseText
else
 'failed
end if

Set oXMLHttp = nothing

End Sub

Call MyASPJob()