Downloade flere filer fra forskellige URL's/HP + eksekvere *.exe
Jeg har fundet info omkring at hente en enkelt fil, men kan desværre ikke få den til at hente flere filer fra f.eks forskellige URL's ? Hvordan laver jeg en gentag funktion med andre variabler ?Accepteret svar: dk_akj
13/03-2004 21:38:46
Point: 60,00 Option Explicit
Const cFIL = "foreningsside_1.pps"
Const cOUT = "C:\temp\"
Const cURL = "http://www.foreningsside.dk/uploads/files/"
Dim intOUT
Dim strOUT
strOUT = cOUT & cFIL
Dim strURL
strURL = cURL & cFIL
Call fetch(strURL,strOUT)
msgbox "Filen er downloadet til: " & strOUT
Function fetch(url,out)
'On Error Resume Next
Err.Clear
Dim b
With CreateObject("Microsoft.XMLHTTP")
.Open "GET",url,False
.Send
b = .ResponseBody
If Err.Number <> 0 Or .Status <> 200 Then
fetch = False
msgbox "fejl"
Exit Function
End If
End With
With CreateObject("ADODB.Stream")
.Type = 1
.Open
.Write b
.SaveToFile out,2
End With
fetch = Err.Number = 0
End Function
//akj
