Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Dim links(2)
- links(0) = "http://cs14101.vk.me/c7007/v7007430/1eead/adfC1UWQgfI.jpg"
- links(1) = "http://cs14101.vk.me/c7007/v7007266/20a96/YHHQY-YPFt0.jpg"
- links(2) = "http://cs14101.vk.me/c7007/v7007266/20a7e/bf3gqbEQ8zo.jpg"
- Dim folder
- folder = SelectFolder(".")
- Dim aux, aux1
- For Each link In links
- aux = Split(link, "?")
- aux1 = Split(aux(0), "/")
- Download link, folder & "/" & aux1( Ubound(aux1) )
- Next
- WScript.Echo "Download has finished."
- Sub Download(url, dst)
- Dim http, stream
- Set http = CreateObject("microsoft.xmlhttp")
- Set stream = CreateObject("adodb.stream")
- http.Open "GET", url, False
- http.Send
- With stream
- .type = 1
- .open
- .write http.responseBody
- .saveToFile dst, 2
- End With
- End Sub
- Function SelectFolder( myStartFolder )
- ' This function opens a "Select Folder" dialog and will
- ' return the fully qualified path of the selected folder
- '
- ' Argument:
- ' myStartFolder [string] the root folder where you can start browsing;
- ' if an empty string is used, browsing starts
- ' on the local computer
- '
- ' Returns:
- ' A string containing the fully qualified path of the selected folder
- '
- ' Written by Rob van der Woude
- ' http://www.robvanderwoude.com
- ' Standard housekeeping
- Dim objFolder, objItem, objShell
- ' Custom error handling
- On Error Resume Next
- SelectFolder = vbNull
- ' Create a dialog object
- Set objShell = CreateObject( "Shell.Application" )
- Set objFolder = objShell.BrowseForFolder( 0, "Select Folder", 0, myStartFolder )
- ' Return the path of the selected folder
- If IsObject( objfolder ) Then SelectFolder = objFolder.Self.Path
- ' Standard housekeeping
- Set objFolder = Nothing
- Set objshell = Nothing
- On Error Goto 0
- End Function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement