Loding the file code:
 
#########################################################################################################
Private Sub mnuspidernet_Click()
l1.ListItems.Clear
 
Dialog.DialogTitle = "Open list.."
Dialog.Filter = "Text File (*.txt)|*.txt"
Dialog.FileName = "rtpubstro.txt"
'dialog.InitDir = ListPath
Dialog.ShowOpen
 
If Dialog.FileName = "" Then Exit Sub
 
On Error GoTo ErrorHandler
Close #1
CurLine = 0
LineCount = 0
 

                         
                         
    Open Dialog.FileName For Input As #1
        Do While Not EOF(1)
            Line Input #1, strHolder
            If Dialog.FileName = "blist.txt" Then
                   CheckLine2 strHolder
                   Else
            CheckLine strHolder
                End If
            DoEvents
        Loop
    Close #1
 

    'save path
        For i = 1 To Len(Dialog.FileName)
          
                pthHolder = RIGHT(Dialog.FileName, i)
                    If InStr(1, pthHolder, "\", vbBinaryCompare) Then
                        SaveSetting "ListReader", "Options", "ListPaht", Left(Dialog.FileName, Len(Dialog.FileName) - i)
                        Exit For
                    End If
        Next i
   
                       
                       
SaveSetting "ListReader", "Options", "AutoLoadList", Dialog.FileName
 
'S1.SimpleText = "Site Count: " & CurLine & " [List " & strHolder & "]"
Exit Sub
ErrorHandler:
If Err.Number = 53 Then
    MsgBox "File not found", vbCritical, "Error"
End If
 
End Sub
##################################################################################################################
 
 
Line Checking Code:
 
###################################################################################################################
 
Sub CheckLine(str_Line As String)
Dim strLen As Integer
Dim strCounter As Integer
Dim strChr As String
Dim str_TO_ADD As String
Dim SiteNumber As String
Dim SiteNumber2 As String
Dim strCounter2 As Integer
    LineCount = LineCount + 1
   
   
   str_TO_ADD = Replace(str_TO_ADD, "", "")
   str_Line = Replace(str_Line, "", "")
  
   If InStr(1, str_TO_ADD, "Site", vbTextCompare) Then
   str_TO_ADD = vbNullString
   End If
  
   If InStr(1, str_Line, "Site", vbTextCompare) Then
   str_Line = vbNullString
   End If
  
  
   If InStr(1, str_TO_ADD, "Comment", vbTextCompare) Then
   str_TO_ADD = vbNullString
   End If
 
   If InStr(1, str_Line, "comment", vbTextCompare) Then
   str_Line = vbNullString
   End If
  
   If InStr(1, str_TO_ADD, "Reason", vbTextCompare) Then
   str_TO_ADD = vbNullString
   End If
  
   If InStr(1, str_Line, "Reason", vbTextCompare) Then
   str_Line = vbNullString
   End If
  
   If InStr(1, str_TO_ADD, "421 count", vbTextCompare) Then
   str_TO_ADD = vbNullString
   End If
  
   If InStr(1, str_Line, "421 count", vbTextCompare) Then
   str_Line = vbNullString
   End If
  
   If InStr(1, str_TO_ADD, "Bad by", vbTextCompare) Then
   str_TO_ADD = vbNullString
   End If
  
   If InStr(1, str_Line, "Bad by", vbTextCompare) Then
   str_Line = vbNullString
   End If
 
strLen = Len(str_Line)
If CurLine = 0 Then
    CurLine = 1
End If
 
If LineCount = 1 Then
    If Mid(str_Line, 1, 1) <> "[" Then
    LineCount = 0
        Exit Sub
    End If
End If
 

    For strCounter = 1 To strLen
               
            If LineCount = 1 Then
                strChr = Mid(str_Line, strCounter, 1)
                SiteNumber = SiteNumber & strChr
                    If strChr = "]" Then
                        SiteNumber2 = RIGHT(SiteNumber, Len(SiteNumber) - 1)
                        SiteNumber2 = Left(SiteNumber2, Len(SiteNumber2) - 1)
                        l1.ListItems.Add CurLine, , SiteNumber2
                    End If
                   
                If strChr = ":" Then
                    'str_TO_ADD = Right(str_Line, strLen - strCounter - 3)
                    str_TO_ADD = RIGHT(str_Line, strLen - strCounter - 3)
                   
                    l1.ListItems(CurLine).ListSubItems.Add 1, , str_TO_ADD
                    Exit For
                End If
            End If
           
            If LineCount = 2 Then
                'Do Until strChr = "/"
                Do Until strChr = "/"
                    DoEvents
        
                    strCounter2 = strCounter2 + 3
                        strChr = Mid(str_Line, strCounter2, 1)
                Loop
               
                str_TO_ADD = Left(str_Line, strCounter2 - 1)
            
               ' l1.ListItems(CurLine).ListSubItems.Add 2, , str_TO_ADD & "/" & Right(str_Line, Len(str_Line) - strCounter2)
                l1.ListItems(CurLine).ListSubItems.Add 2, , RIGHT(str_Line, Len(str_Line) - strCounter2)
              If Check2.Value = 1 Then
                        success = Ping((str_TO_ADD), ("TEST"), ECHO)
                            If ECHO.RoundTripTime = 262164 Then
                                l1.ListItems(CurLine).ListSubItems.Add 3, , ""
                                GoTo nextstep:
                            End If
                        l1.ListItems(CurLine).ListSubItems.Add 3, , ECHO.RoundTripTime & " ms"
                     
nextstep:
                            If ECHO.RoundTripTime < 100 Then
                                l1.ListItems(CurLine).ListSubItems.Add 4, , "GOOD"
                                l1.ListItems(CurLine).ListSubItems(4).ForeColor = vbGreen
                            ElseIf ECHO.RoundTripTime < 250 And ECHO.RoundTripTime > 100 Then
                                l1.ListItems(CurLine).ListSubItems.Add 4, , "OK"
                                l1.ListItems(CurLine).ListSubItems(4).ForeColor = vbBlue
                            ElseIf ECHO.RoundTripTime > 250 And ECHO.RoundTripTime < 262164 Then
                                l1.ListItems(CurLine).ListSubItems.Add 4, , "BAD"
                                l1.ListItems(CurLine).ListSubItems(4).ForeColor = vbRed
                            ElseIf ECHO.RoundTripTime = 262164 Then
                                l1.ListItems(CurLine).ListSubItems.Add 5, , ""
                                l1.ListItems(CurLine).ListSubItems(4).ForeColor = vbRed
                                l1.ListItems(CurLine).ListSubItems(4).Bold = True
                            End If
                           
                    End If
                   
                Exit For
            End If
           
               
           If LineCount = 3 Then
                l1.ListItems(CurLine).Tag = str_Line
                Exit For
           End If
           
   
    Next
 
    If LineCount = 4 Then
        LineCount = 0
        CurLine = CurLine + 1
    End If
 
End Sub
###################################################################################################################
 
With the current checking code, when it sees that the first character is not a "[" it bypasses the line
i just want to add that "[" at the beginning of the line
My brain is fried atm but i know it has to be simple like a "position" statement or something
 
Many thanks ...
 
 
----- Original Message -----
Sent: Monday, November 08, 2004 11:37 AM
Subject: RE: PSC string functions..

Can you share a sample of the code you are currently using to read through the lines of the file?

 

-----Original Message-----
From: Michael J Wallace [mailto:[EMAIL PROTECTED]
Sent: Monday, November 08, 2004 9:25 AM
To: [EMAIL PROTECTED]
Subject: Re: PSC string functions..

 

I guess i need to clarify a little better :)

 

 

a sample line is like this: 7706 <11 Jul 2004 14:42>

 

all lines are starting with a 4 number set, the date following is of no consequence.

 

i want to place brackets "[" at the beginning and end of the number sequence so it looks like [7706].

 

I have almost all of it sorted except how to place the bracket at the BEGINNING which is driving me completely nuts

 

Thanks yet again ...

 

Mike

----- Original Message -----

Sent: Monday, November 08, 2004 4:30 AM

Subject: RE: PSC string functions..

 

maybe u gonna laugh at this...i got string1 and string2. you want string1 to be placed in string2....

string2=string1 & string2

that's it!!!

Ian <[EMAIL PROTECTED]> wrote:

MyString="bcd"
MyString = "a" and MyString
'MyString now = "abcd"

Lu.


-----Original Message-----
From: udtmang [mailto:[EMAIL PROTECTED]
Sent: 08 November 2004 08:10
To: [EMAIL PROTECTED]
Subject: PSC string functions..




Does any one know how to add a character to the BEGINNING of a line ?







To unsubscribe, send an email to:
[EMAIL PROTECTED]


Yahoo! Groups Links











To unsubscribe, send an email to:
[EMAIL PROTECTED]




Yahoo! Messenger - Communicate instantly..."Ping" your friends today! Download Messenger Now

To unsubscribe, send an email to:
[EMAIL PROTECTED]






To unsubscribe, send an email to:
[EMAIL PROTECTED]







To unsubscribe, send an email to:
[EMAIL PROTECTED]






To unsubscribe, send an email to:
[EMAIL PROTECTED]




Yahoo! Groups Sponsor
ADVERTISEMENT
click here
Web Bug from http://us.adserver.yahoo.com/l?M=295196.4901138.6071305.3001176/D=groups/S=:HM/A=2128215/rand=718762949


Yahoo! Groups Links

Reply via email to