Sam80
asked on
How ot use a script file to download a file ?
I want to download a file from the web
like http://www.abc.com/file.txt , use the script file.
but there seems no object support this function.
like http://www.abc.com/file.txt , use the script file.
but there seems no object support this function.
https://www.experts-exchange.com/questions/20548851/How-save-save-website-with-a-click.html
ASKER
Thanks , aelatik .
The function is just what i want.
but in vb script ,I can not use the window api function,which force me had to find out an object that can attain this requirement.
I will be greatly appreciate to your new answer.
The function is just what i want.
but in vb script ,I can not use the window api function,which force me had to find out an object that can attain this requirement.
I will be greatly appreciate to your new answer.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This function will work from VBS. It relies on MS XML
However, It might need some modification in creating the object. Try the commented line if the first did not work
Function GetHTML(sURL As String) As String
Dim objXMLHTTP, xml
Set xml = CreateObject("Microsoft.XM LHTTP")
' Set xml = CreateObject("MSXML2.XMLHT TP")
xml.Open "GET", sURL, False
xml.send
GetHTML = xml.responseText
Set xml = Nothing
End Function
Good luck
However, It might need some modification in creating the object. Try the commented line if the first did not work
Function GetHTML(sURL As String) As String
Dim objXMLHTTP, xml
Set xml = CreateObject("Microsoft.XM
' Set xml = CreateObject("MSXML2.XMLHT
xml.Open "GET", sURL, False
xml.send
GetHTML = xml.responseText
Set xml = Nothing
End Function
Good luck
If its just for text and other type of pages use :
Dim IE
Set IE = CreateObject("InternetExpl orer.Appli cation")
IE.Navigate "http://www.abc.com/file.txt"
While IE.Busy
Wend
GetHTMLCode = IE.Document.documentelemen t.innerHTM L
MsgBox GetHTMLCode
Dim IE
Set IE = CreateObject("InternetExpl
IE.Navigate "http://www.abc.com/file.txt"
While IE.Busy
Wend
GetHTMLCode = IE.Document.documentelemen
MsgBox GetHTMLCode
hearing...
ASKER
thanks , guys, excellent!!!
and now i want one more function is that save the file to the specific folder , how ?
and now i want one more function is that save the file to the specific folder , how ?
ASKER
how about if my request file is not a text file ?
it might be any kind such as exe,jpg and so on.
it might be any kind such as exe,jpg and so on.
Hi Sam80,
This old question (QID 20562465) needs to be finalized -- accept an answer, split points, or get a refund. Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.
This old question (QID 20562465) needs to be finalized -- accept an answer, split points, or get a refund. Please see http://www.cityofangels.com/Experts/Closing.htm for information and options.