Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
ivan_will
Partner - Creator II
Partner - Creator II

MACRO that downloads single/multiple file/s to a directory

Hi,

Could anyone help me with a VB script that downloads single/multiple file/s to a directory.

I am testing some examples but without any results:

UrlDownloadToFile, http://...... .pdf,  D:\test.pdf

or

URLDownloadToFile 0, _

"http://..... .pdf", _

"D:\test.pdf", 0, 0

Thanks in advance!

ps prefer script for multiples files if any

7 Replies
kaushiknsolanki
Partner Ambassador/MVP
Partner Ambassador/MVP

HI,

   Here is the macro which i got from web. Not sure will this work or not.

  

Sub Download( myFileURL, myDestFile )

' This function uses X-standards.com's X-HTTP component to download a file

'

' Arguments:

' myFileURL  [string] the URL of the file to be downloaded

' myDestFile [string] the fully qualified path of the downloaded "target" file

'

' Written by Rob van der Woude

' http://www.robvanderwoude.com

'

' The X-HTTP component is available at:

' http://www.xstandard.com/page.asp?p=C8AACBA3-702F-4BF0-894A-B6679AA949E6

' For more information on available functionality read:

' http://www.xstandard.com/printer-friendly.asp?id=32ADACB9-6093-452A-9464-9269867AB16E

    Dim objHTTP

    Set objHTTP = CreateObject("XStandard.HTTP")

    objHTTP.Get myFileURL

    objHTTP.SaveResponseToFile myDestFile

    Set objHTTP = Nothing

End Sub

Regards,

Kaushik Solanki

Please remember to hit the 'Like' button and for helpful answers and resolutions, click on the 'Accept As Solution' button. Cheers!
ivan_will
Partner - Creator II
Partner - Creator II
Author

Ohh

Can't manage to do that works. I have search and tried another examples but without any success.

Miguel_Angel_Baeyens

Hi Ivan,

I'd rather use wget or something similar and call if from macro (if any) to get the files you want, using the Launch member of the Application class in the API (check the APIGuide.qvw file for further reference and examples).

Hope that helps.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

ivan_will
Partner - Creator II
Partner - Creator II
Author

No , I don't want using any other programs to do that.

Using macro is better for my purposes.

Any other ideas of macro doing the download function?

Tnx

Miguel_Angel_Baeyens

Hi,

Googling returns a good bunch of VBScript examples either using proprietary controls or making use of the FTP command already existing in the Windows operating system, which probably assures the portability. You will need an external control or application anyway unless you use the "Use FTP" check in the script editor dialog (if that helps).

Note that in the server-client environment there are some macros that are not triggered (On Open, On Post Reload...) although they should work manually with the plugin or desktop clients.

Regards.

Miguel Angel Baeyens

BI Consultant

Comex Grupo Ibérica

ivan_will
Partner - Creator II
Partner - Creator II
Author

Other ideas ?

Thanks!

ivan_will
Partner - Creator II
Partner - Creator II
Author

Has anyone some examples

thx