![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Reading text file at a URL Hello, Is there way to read a text file which is located at a URL. for example http://www.abc.com/test/name.txt I want to read the contents of the text file which is available at the URL and copy the contents to another file locally. Thanks |
My System Specs![]() |
| | #2 (permalink) |
| | RE: Reading text file at a URL Does any one have any clue on this? |
My System Specs![]() |
| | #3 (permalink) |
| | Re: Reading text file at a URL "Codeblack" <Codeblack@xxxxxx> wrote in message news:49258A75-03A4-47A1-A9F7-255377D4AF4B@xxxxxx Quote: > Hello, > > Is there way to read a text file which is located at a URL. for example > http://www.abc.com/test/name.txt > > I want to read the contents of the text file which is available at the URL > and copy the contents to another file locally. VBScript can easily download any type file, including password-protected files (if you know the username and password), by using the xmlhttp object included with most recent versions of Windows. Groups.google can give you a relatively short list of hits, so you don't have to wade through millions of useless info. Go to groups.google.com and paste the following into the search box: download file xmlhttp group:*.scripting.vbscript -Paul Randall |
My System Specs![]() |
| | #4 (permalink) |
| | Re: Reading text file at a URL Thanks for this. But is it possible to download a pdf file and save it as text file. |
My System Specs![]() |
| | #5 (permalink) |
| | Re: Reading text file at a URL On Apr 1, 7:35*am, vasuki.ramakris...@xxxxxx wrote: Quote: > Thanks for this. But is it possible to download a pdf file and save it > as text file. be a PDF - unless you have a PDF to Text converter to do that part of the job. The following routine will retrieve the file from the web ... Sub DownBinFile(FilePath, sURL) const adTypeBinary = 1 const adModeReadWrite = 3 const adSaveCreateOverwrite = 2 ' Create an xmlhttp object: set oXML = CreateObject("MSXML2.XMLHTTP") oXML.open "GET", sURL, False oXML.send With CreateObject("ADODB.Stream") .type = adTypeBinary .mode = adModeReadWrite .open Do Until oXML.readyState = 4 : Wscript.Sleep 50 : loop .write oXML.responseBody .savetofile FilePath, adSaveCreateOverwrite End With ' ADODB.Stream End Sub The Filepath is the name and location where the result is to be stored, while sURL contains the full designation of the URL, including the http:// part. This could be used for ftp downloads as well, as long as the proper inline login syntax is provided as part of the sURL string. The conversion of the pdf is not part of my expertise, so you're on your own on that part. Tom Lavedas *********** http://there.is.no.more/tglbatch/ |
My System Specs![]() |
| | #6 (permalink) |
| | Re: Reading text file at a URL On Apr 1, 7:04*am, T Lavedas <tglba...@xxxxxx> wrote: Quote: > On Apr 1, 7:35*am, vasuki.ramakris...@xxxxxx wrote: > Quote: > > Thanks for this. But is it possible to download a pdf file and save it > > as text file. > Short answer is it can be downloaded from the URL, but it will still > be a PDF - unless you have a PDF to Text converter to do that part of > the job. > > The following routine will retrieve the file from the web ... > > Sub DownBinFile(FilePath, sURL) > * const adTypeBinary = 1 > * const adModeReadWrite = 3 > * const adSaveCreateOverwrite = 2 > *' Create an xmlhttp object: > * set oXML = CreateObject("MSXML2.XMLHTTP") > * oXML.open "GET", sURL, False > * oXML.send > * With CreateObject("ADODB.Stream") > * * .type = adTypeBinary > * * .mode = adModeReadWrite > * * .open > * * Do Until oXML.readyState = 4 : Wscript.Sleep 50 : loop > * * .write oXML.responseBody > * * .savetofile FilePath, adSaveCreateOverwrite > * End With ' ADODB.Stream > End Sub > > The Filepath is the name and location where the result is to be > stored, while sURL contains the full designation of the URL, including > the http:// part. *This could be used for ftp downloads as well, as > long as the proper inline login syntax is provided as part of the sURL > string. > > The conversion of the pdf is not part of my expertise, so you're on > your own on that part. > > Tom Lavedas > ***********http://there.is.no.more/tglbatch/ Free Text To PDF Converter: http://www.sanface.com/txt2pdf.html I use txt2pdf.exe in my scripts. |
My System Specs![]() |
| | #7 (permalink) |
| | Re: Reading text file at a URL On Apr 6, 3:03*pm, HL0105 <tron9...@xxxxxx> wrote: Quote: > On Apr 1, 7:04*am, T Lavedas <tglba...@xxxxxx> wrote: > > > Quote: > > On Apr 1, 7:35*am, vasuki.ramakris...@xxxxxx wrote: Quote: Quote: > > > Thanks for this. But is it possible to download a pdf file and save it > > > as text file. Quote: > > Short answer is it can be downloaded from the URL, but it will still > > be a PDF - unless you have a PDF to Text converter to do that part of > > the job. Quote: > > The following routine will retrieve the file from the web ... Quote: > > Sub DownBinFile(FilePath, sURL) > > * const adTypeBinary = 1 > > * const adModeReadWrite = 3 > > * const adSaveCreateOverwrite = 2 > > *' Create an xmlhttp object: > > * set oXML = CreateObject("MSXML2.XMLHTTP") > > * oXML.open "GET", sURL, False > > * oXML.send > > * With CreateObject("ADODB.Stream") > > * * .type = adTypeBinary > > * * .mode = adModeReadWrite > > * * .open > > * * Do Until oXML.readyState = 4 : Wscript.Sleep 50 : loop > > * * .write oXML.responseBody > > * * .savetofile FilePath, adSaveCreateOverwrite > > * End With ' ADODB.Stream > > End Sub Quote: > > The Filepath is the name and location where the result is to be > > stored, while sURL contains the full designation of the URL, including > > the http:// part. *This could be used for ftp downloads as well, as > > long as the proper inline login syntax is provided as part of the sURL > > string. Quote: > > The conversion of the pdf is not part of my expertise, so you're on > > your own on that part. Quote: > Free Text To PDF Converter: > > http://www.sanface.com/txt2pdf.html > > I use txt2pdf.exe in my scripts. Tom Lavedas *********** http://there.is.no.more/tglbatch/ |
My System Specs![]() |
| | #8 (permalink) |
| | Re: Reading text file at a URL Here's a link for one of those; in fact, there are several handy PDF tools in the free Xpdf toolkit: http://www.foolabs.com/xpdf/download.html "T Lavedas" <tglbatch@xxxxxx> wrote in message news:cf68fdb1-e510-4a73-91a3-6fca2a478c69@xxxxxx Quote: > On Apr 6, 3:03 pm, HL0105 <tron9...@xxxxxx> wrote: Quote: >> On Apr 1, 7:04 am, T Lavedas <tglba...@xxxxxx> wrote: >> >> >> Quote: >> > On Apr 1, 7:35 am, vasuki.ramakris...@xxxxxx wrote: Quote: >> > > Thanks for this. But is it possible to download a pdf file and save >> > > it >> > > as text file. Quote: >> > Short answer is it can be downloaded from the URL, but it will still >> > be a PDF - unless you have a PDF to Text converter to do that part of >> > the job. Quote: >> > The following routine will retrieve the file from the web ... Quote: >> > Sub DownBinFile(FilePath, sURL) >> > const adTypeBinary = 1 >> > const adModeReadWrite = 3 >> > const adSaveCreateOverwrite = 2 >> > ' Create an xmlhttp object: >> > set oXML = CreateObject("MSXML2.XMLHTTP") >> > oXML.open "GET", sURL, False >> > oXML.send >> > With CreateObject("ADODB.Stream") >> > .type = adTypeBinary >> > .mode = adModeReadWrite >> > .open >> > Do Until oXML.readyState = 4 : Wscript.Sleep 50 : loop >> > .write oXML.responseBody >> > .savetofile FilePath, adSaveCreateOverwrite >> > End With ' ADODB.Stream >> > End Sub Quote: >> > The Filepath is the name and location where the result is to be >> > stored, while sURL contains the full designation of the URL, including >> > the http:// part. This could be used for ftp downloads as well, as >> > long as the proper inline login syntax is provided as part of the sURL >> > string. Quote: >> > The conversion of the pdf is not part of my expertise, so you're on >> > your own on that part. Quote: >> Free Text To PDF Converter: >> >> http://www.sanface.com/txt2pdf.html >> >> I use txt2pdf.exe in my scripts. > The OP was in need of a PDF to text converter. > > Tom Lavedas > *********** > http://there.is.no.more/tglbatch/ |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Reading A Text File | VB Script | |||
| Reading file names and Searching for text | VB Script | |||
| Reading a text file with StreamReader | .NET General | |||
| Refresh on Reading more than one variable from a Text file | VB Script | |||
| Reading text file and charting them via powergadget | PowerShell | |||