Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

index.dat entries with today's date 1

Status
Not open for further replies.

Dbyte

Technical User
Mar 6, 2002
87
Here is my code:
Code:
Sub FindLinks(strMatchPattern, strPhrase, file)
   Dim oRE, oMatches, oMatch, dt, start, sArray, timeStamp, url, sToday

   Set oRE = New RegExp
   oRE.Pattern = strMatchPattern
   oRE.Global = True
   oRE.IgnoreCase = False
   Set oMatches = oRE.Execute(strPhrase)
   [highlight]sToday = CDate(Date)[/highlight]

   For Each oMatch In oMatches
      start = Instr(oMatch.FirstIndex + 1,strPhrase,": ")
      If start <> 0 Then
         sArray = Split(Mid(strPhrase,start+2),"@")
         url=Left(sArray(1),InStr(sArray(1),chr(0)))
         dt=AsciiToHex(Mid(strPhrase,oMatch.FirstIndex+1+16,8))
         timeStamp = cvtDate(dt(7)&dt(6)&dt(5)&dt(4),dt(3)&dt(2)&dt(1)&dt(0))
         [highlight]If timeStamp = sToday Then[/highlight]
            oTextStream.WriteLine "<tr><td nowrap><font color=green size=2>"&sArray(0)&"</font></td>"+"<td nowrap><font color=red size=2>&nbsp; "&timeStamp&"</font></td>"&"<td nowrap><font size=2>&nbsp; <a href="&url&">"&url&"</a></font></td></tr>"
         [highlight]End If[/highlight]
      End If
   Next
End Sub
This is part of a larger script that searches recursively thru all index.dat files & pulls URLs accessed by a user. The subroutine above was pulling all URLs regardless of date until I added the highlighted lines. Now I get no URLs.
I don't know if the problem is here or that the binary values for the dates aren't being converted to strings correctly. If someone can confirm for me that my highlighted entries are sound I'll look into the binary-to-string issue.
 
What is cvtDate ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
DOH! Left that out by accident. Here is the cvtDate function:
Code:
Function cvtDate(hi,lo)
   On Error Resume Next
   cvtDate = #1/1/1601# + (((cdbl("&H0" & hi) * (2 ^ 32)) + cdbl("&H0" & lo))/600000000 - nBias)/1440
   cvtDate = CDate(cvtDate)
   If Err.Number <> 0 Then
      On Error GoTo 0
      cvtDate = #1/1/1601#
      Err.Clear
   End If
   On Error GoTo 0  
End Function
 
What about this ?
If Int(timeStamp) = Int(Now) Then

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Worked perfectly PHV - star for you. Thanks for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top