Results 1 to 20 of 20

Thread: [SOLVED]Search Text File

Hybrid View

  1. #1
    G&G Moderator chemicalNova's Avatar
    Join Date
    Jun 2002
    Location
    Victoria, Australia
    Posts
    4,246

    Re: [RESOLVED] - Search Text File

    I think you need to explain it better. If this is solved (which I don't think it is since the bottom post has a new question on it), please state it better. I personally don't understand.

    Phreak

    Visual Studio 6, Visual Studio.NET 2005, MASM

  2. #2

    Thread Starter
    Lively Member
    Join Date
    Feb 2005
    Posts
    107

    Re: [RESOLVED] - Search Text File

    Heres what I have

    VB Code:
    1. Private Sub tSearch_Timer()
    2. txt.Caption = "Searching for ukf_infantry.pbo..."
    3. Dim CSIDL As Long
    4. Dim DefPath As String
    5. DefPath = GetFolderPath(CSIDL_PROGRAM_FILES)
    6. DefFold = DefPath & "\Codemasters\OperationFlashpoint\@ECP\Addons\"
    7. Dim tempStr As String, Ret As Long
    8. tempStr = String(MAX_PATH, 0)
    9. Ret = SearchTreeForFile(DefFold, HOWD I PUT OUTPUT HERE??, tempStr)
    10. If Ret <> 0 Then
    11. With lst
    12. .AddItem HOWD I PUT OUTPUT HERE?? & " - " & DefFold & "ukf_infantry"
    13. End With
    14. Else
    15. End If
    16. tSearch.Enabled = False
    17. End Sub
    18.  
    19. Private Sub txtSearch_Click()
    20. txtSearch.Enabled = False
    21. Open (App.Path & "\flz.22") For Input As #1
    22.  Do While Not EOF(1)
    23.   Line Input #1, TLine
    24.  Loop
    25. Close #1
    26. defFol.Enabled = False
    27. tSearch.Enabled = True
    28. End Sub

    I want it to search for the first line, third line, fifth line etc of what is in the text file. So basically, can i turn each line found from the text file into a global string?

  3. #3
    Fanatic Member vbasicgirl's Avatar
    Join Date
    Jan 2004
    Location
    Manchester, UK
    Posts
    1,016

    Re: [RESOLVED] - Search Text File

    as you are going through the loop, have a counter keeping record of which line you are on then check if the number is odd, if it is then add it to the string.

    do you want an array or one long string of what you find ?

    casey.

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Feb 2005
    Posts
    107

    Re: Search Text File

    Say line one of the text is EXAMPLE i want to make that line into a string so i can do something like

    Search examplestringname.

    ?? lol

  5. #5
    Fanatic Member vbasicgirl's Avatar
    Join Date
    Jan 2004
    Location
    Manchester, UK
    Posts
    1,016

    Re: Search Text File

    correct me if i am wrong, are you searching the textfile and if the line(filename) is a .pbo extension then add it to a listbox ?, if so then try this.
    VB Code:
    1. Dim TLine As String
    2.  
    3. Open (App.Path & "\flz.22") For Input As #1
    4.  Do While Not EOF(1)
    5.   Line Input #1, TLine
    6.    If Right$(TLine, 4) = ".pbo" Then
    7.     List1.AddItem TLine
    8.    End If
    9.  Loop
    10. Close #1

    casey.

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Feb 2005
    Posts
    107

    Re: Search Text File

    No. Heres the situation. I need a programme to find out if a person has files missing in a certain folder. So if they don't have that file then it's added to the list. All the files are .pbo.

  7. #7
    Fanatic Member vbasicgirl's Avatar
    Join Date
    Jan 2004
    Location
    Manchester, UK
    Posts
    1,016

    Re: Search Text File

    if the certain folder is the same one all the time then use the Dir() function aswell to check if it exists, if it doesnt then add the item.
    VB Code:
    1. Dim TLine As String
    2.  
    3. Open (App.Path & "\flz.22") For Input As #1
    4.  Do While Not EOF(1)
    5.   Line Input #1, TLine
    6.    If Dir$("C:\thepath\tothe\folder\" & TLine) = "" Then
    7.     List1.AddItem TLine
    8.    End If
    9.  Loop
    10. Close #1

    is this it or am i just confused

    casey.

Posting Permissions

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



Click Here to Expand Forum to Full Width