Automate a asp page

Results 1 to 2 of 2

Thread: Automate a asp page

  1. #1
    Join Date
    Dec 1969

    Default Automate a asp page

    I have a script below used to pull newsfeeds. However it doesn&#039;t pull on a time basis. I was hoping someone could spend a couple minutes with me right now writing a short function that using the the current time as a variable, would wait until 2 hours later to refresh the page. Is this possible? Thanks! This is a very important project. Thanks in advance!<BR><BR><BR><BR>&#060;%<BR>Dim objXML<BR>Dim objXSL<BR>Dim objFSO<BR>Dim strFile<BR>Dim strFileName<BR>Dim strXSL<BR>Dim strURL<BR><BR>&#039; File extension<BR>strFileName = "headlines.xml"<BR><BR><BR>strFile = Year(Now) & Month(now) & Day(now) & strFileName <BR><BR>&#039; Style sheet<BR>strXSL = "headlines.xsl"<BR><BR>&#039; URL for XML Feed<BR>strURL = ""<BR><BR>Set objFSO = Server.CreateObject("Scripting.FileSystemObject")< BR><BR>&#039; If a current file for this hour doesn&#039;t exist, then get a new one.<BR>If Not (objFSO.FileExists(Server.MapPath(strFile))) Then<BR> Set objXML = CreateObject("MSXML2.ServerXMLHTTP")<BR><BR> objXML.Open "Post", strURL, False<BR> objXML.Send <BR> xmlGet = objXML.responseText<BR><BR> &#039; Create new XML file<BR> Const ForReading = 1, ForWriting = 2, ForAppending = 8<BR> Dim fso, f<BR> Set fso = CreateObject("Scripting.FileSystemObject")<BR> Set f = fso.OpenTextFile(Server.MapPath(strFile), ForWriting, True)<BR> f.Write xmlGet<BR> f.Close<BR><BR> Set objXML = Nothing<BR><BR> &#039; Now delete any older files<BR> Set objFolder = objFSO.GetFolder(Server.MapPath("./"))<BR> For Each objFile in objFolder.Files<BR> If (objFile.Name = strFile) or Instr(objFile, strFileName)=0 then<BR> Else<BR> objFSO.DeleteFile(Server.MapPath(objFile.Name))<BR > End If<BR> Next<BR>End If<BR>Set objFSO = nothing<BR><BR>&#039; Now load XML and XSL documents<BR>Set objXML = Server.CreateObject("Microsoft.XMLDOM")<BR>Set objXSL = Server.CreateObject("Microsoft.XMLDOM")<BR>objXML. load(Server.MapPath(strFile))<BR>objXSL.load(Serve r.MapPath(strXSL))<BR>Response.Write objXML.transformNode(objXSL)<BR>Set objXML = Nothing<BR>Set objXSL = Nothing<BR>%&#062;

  2. #2
    Wasabi Guest

    Default sounds like

    you need to utilize Application variables...<BR>&#039;-- this is very rough code.. you&#039;d need to definitely fix this if statement, but that&#039;s the general idea<BR>If (CDate(Application("LastTimeRefreshed")) &#060;= CDate(Now - 2) Then<BR> Application("LastTimeRefreshed") = Now<BR> &#039;-- Do whatever you need to do to refresh the page here<BR>End If<BR><BR>Hope that helps!<BR><BR>Wasabi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts