[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:
Private Sub cmdupdatecheck_Click()
' download the updates information text file:
DownloadFile "http://www.csscobalt.com/uploads/updated_files.txt", "c:\updated_files.txt"
' open the updated_files.txt file
Dim File1Data, File2Data As String
Open "c:\updated_files.txt" For Input As 2
Line Input #1, File1Data
Line Input #2, File2Data
'take the prefix of the know URL and add the file name at the end, creating a complete URL.
Dim File1DataUrl
Dim File2DataUrl
File1DataUrl = "http://www.csscobalt.com/uploads/" & File1Data
File2DataUrl = "http://www.csscobalt.com/uploads/" & File2Data
'make a correct Save Path
Dim File1DataUrlSave
Dim File2DataUrlSave
File1DataUrlSave = App.Path & "upload_files/" & File1Data
File2DataUrlSave = App.Path & "upload_files/" & File2Data
'ACTUALLY Download the file:
DownloadFile File2DataUrl, File1DataUrlSave
DownloadFile File2DataUrl, File2DataUrlSave
Close 2, 1
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?
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..!
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:
Open "TESTFILE" For Input As #1 ' Open file.
Do While Not EOF(1) ' Loop until end of file.
Line Input #1, TextLine ' Read line into variable.
Debug.Print TextLine ' Print to Debug window.
Loop
Close #1 ' Close file.