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
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
"Codeblack" <Codeblack@xxxxxx> wrote in message
news:49258A75-03A4-47A1-A9F7-255377D4AF4B@xxxxxxWhy restrict your self to downloading text files?
> 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
Thanks for this. But is it possible to download a pdf file and save it
as text file.
On Apr 1, 7:35*am, vasuki.ramakris...@xxxxxx wrote:Short answer is it can be downloaded from the URL, but it will still
> 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/
On Apr 1, 7:04*am, T Lavedas <tglba...@xxxxxx> wrote:
> On Apr 1, 7:35*am, vasuki.ramakris...@xxxxxx wrote:
>>
> > 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.
On Apr 6, 3:03*pm, HL0105 <tron9...@xxxxxx> wrote:The OP was in need of a PDF to text converter.
> On Apr 1, 7:04*am, T Lavedas <tglba...@xxxxxx> wrote:
>
>
>>
> > On Apr 1, 7:35*am, vasuki.ramakris...@xxxxxx wrote:>
> > > 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.>
> 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/
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
> On Apr 6, 3:03 pm, HL0105 <tron9...@xxxxxx> wrote:>
>> On Apr 1, 7:04 am, T Lavedas <tglba...@xxxxxx> wrote:
>>
>>
>>>>
>> > On Apr 1, 7:35 am, vasuki.ramakris...@xxxxxx wrote:>>
>> > > 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.>>
>> 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/
| Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Reading A Text File | vqthomf | VB Script | 2 | 19 Aug 2009 |
| Reading file names and Searching for text | Codeblack | VB Script | 11 | 22 Mar 2009 |
| Reading a text file with StreamReader | km | .NET General | 3 | 16 Oct 2008 |
| Refresh on Reading more than one variable from a Text file | OldDog | VB Script | 4 | 11 Sep 2008 |
| Reading text file and charting them via powergadget | IT Staff | PowerShell | 2 | 19 Mar 2008 |