Results 1 to 3 of 3

Thread: [RESOLVED]Get Lines Separately[RESOLVED]

  1. #1

    Thread Starter
    Junior Member JustinMs66's Avatar
    Join Date
    Jun 2006
    Location
    CA, USA, EARTH
    Posts
    21

    [RESOLVED]Get Lines Separately[RESOLVED]

    i want to have 1 text file, and that text file will have like:
    myfile1.dll
    myfile2.exe
    myfile3.php

    and i want to be able to access each line separately. because in each line will contain a URL to a file, which will then be downloaded. here is what i have so far:
    my code:
    VB Code:
    1. Private Sub cmdupdatecheck_Click()
    2.     ' download the updates information text file:
    3.     DownloadFile "http://www.csscobalt.com/uploads/updated_files.txt", "c:\updated_files.txt"
    4.        
    5.     ' open the updated_files.txt file
    6.     Dim File1Data, File2Data As String
    7. Open "c:\updated_files.txt" For Input As 2
    8.     Line Input #1, File1Data
    9.     Line Input #2, File2Data
    10.  
    11. 'take the prefix of the know URL and add the file name at the end, creating a complete URL.
    12. Dim File1DataUrl
    13. Dim File2DataUrl
    14. File1DataUrl = "http://www.csscobalt.com/uploads/" & File1Data
    15. File2DataUrl = "http://www.csscobalt.com/uploads/" & File2Data
    16.  
    17. 'make a correct Save Path
    18. Dim File1DataUrlSave
    19. Dim File2DataUrlSave
    20. File1DataUrlSave = App.Path & "upload_files/" & File1Data
    21. File2DataUrlSave = App.Path & "upload_files/" & File2Data
    22.  
    23. 'ACTUALLY Download the file:
    24. DownloadFile File2DataUrl, File1DataUrlSave
    25. DownloadFile File2DataUrl, File2DataUrlSave
    26. Close 2, 1
    27. End Sub
    now NORMALLY, you would have to do:
    DownloadFile "http://www.csscobalt.com/uploads/myfile.php", "c:\myfile.php"
    but i can't do that because i won't know the actual file name.

    and also i know that my line separation of the txt file code is completely wrong... but it's a start.
    can anyone PLEASE help me with this?
    Last edited by JustinMs66; Sep 20th, 2006 at 02:54 PM.

  2. #2
    Frenzied Member some1uk03's Avatar
    Join Date
    Jun 2006
    Location
    London, UK
    Posts
    1,675

    Re: Get Lines of a Text File, Separately, > URL to Download: HELP!!!

    Just use an .INI file to simplify ur life...!!

    Itll do just what you want..!
    _____________________________________________________________________

    ----If this post has helped you. Please take time to Rate it.
    ----If you've solved your problem, then please mark it as RESOLVED from Thread Tools.



  3. #3
    Addicted Member
    Join Date
    Mar 2002
    Location
    Lithuania
    Posts
    165

    Re: Get Lines of a Text File, Separately, > URL to Download: HELP!!!

    From manual:
    This example uses the Line Input # statement to read a line from a sequential file and assign it to a variable. This example assumes that TESTFILE is a text file with a few lines of sample data.
    VB Code:
    1. Open "TESTFILE" For Input As #1 ' Open file.
    2. Do While Not EOF(1) ' Loop until end of file.
    3.     Line Input #1, TextLine ' Read line into variable.
    4.     Debug.Print TextLine    ' Print to Debug window.
    5. Loop
    6. Close #1    ' Close file.
    P.S. Sorry for my poor English...

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