Community in read only mode June 18 & 19
This community will be set in READ ONLY mode for a while on Tuesday June 18 into Wednesday June 19 while we import content and users from our Micro Focus Forums community site. MORE INFORMATION
liorde Honored Contributor.
Honored Contributor.
366 views

Browser save as, how to perform faster ..?

Jump to solution

Hello colleagues.
I would like to handle an issue of saving files to a network driver, in a quicker way...
My automation goes over a list of 100 files on a certain websote, and using some logic decides what to download.

The regular manual way be to right click and choose "Save as", and so forth...

I need to automate this to be in a more elegant and efficient way. How would you suggest I do this??Because currently I am doing this using the menus: Save As -> Save dialog etc... very ugly and very timely.

What do you suggest??

Thank-you!!

 

0 Likes
1 Solution

Accepted Solutions
Micro Focus Expert
Micro Focus Expert

Re: Browser save as, how to perform faster ..?

Jump to solution

You could determine the URL (href), e.g. like:

 

href = Browser("Content and PDFs").Page("Content and PDFs").Image("_TopNav_cp-adobe").Object.href

and then save the document via some vbs code such as e.g. 

dim xHttp: Set xHttp = createobject("Microsoft.XMLHTTP")
dim bStrm: Set bStrm = createobject("Adodb.Stream")
xHttp.Open "GET", href, False
xHttp.Send

with bStrm
    .type = 1 '//binary
    .open
    .write xHttp.responseBody
    .savetofile "c:\temp\xxx.png", 2 '//overwrite
end with

which I found here:

https://stackoverflow.com/questions/2973136/download-a-file-with-vbs

 

4 Replies
Micro Focus Expert
Micro Focus Expert

Re: Browser save as, how to perform faster ..?

Jump to solution

You could determine the URL (href), e.g. like:

 

href = Browser("Content and PDFs").Page("Content and PDFs").Image("_TopNav_cp-adobe").Object.href

and then save the document via some vbs code such as e.g. 

dim xHttp: Set xHttp = createobject("Microsoft.XMLHTTP")
dim bStrm: Set bStrm = createobject("Adodb.Stream")
xHttp.Open "GET", href, False
xHttp.Send

with bStrm
    .type = 1 '//binary
    .open
    .write xHttp.responseBody
    .savetofile "c:\temp\xxx.png", 2 '//overwrite
end with

which I found here:

https://stackoverflow.com/questions/2973136/download-a-file-with-vbs

 

Highlighted
liorde Honored Contributor.
Honored Contributor.

Re: Browser save as, how to perform faster ..?

Jump to solution

OK, 
I tried this out, and I failed on the last command, the write command:
Please view the attached image..:

Could this be a permission error?  Syntax error?? What do you think ?

 

0 Likes
liorde Honored Contributor.
Honored Contributor.

Re: Browser save as, how to perform faster ..?

Jump to solution

Hi Thomas.

I owe you a small update... apparently, the last command DOES NOT create the folder, if this does not exist... So that was my bad.. I did not know that ws a prerequisite. The save folder must be there prior to the write  command

So solution accepted Thomas, than-you very much!

 

0 Likes
liorde Honored Contributor.
Honored Contributor.

Re: Browser save as, how to perform faster ..?

Jump to solution

I would lke to raise this issue again:


Apparently the download process indeeds downloads...SOMETHING.
But not the file, as you would download it, the GUI way (i.e. right click-> save target as-> confirm file location)
So the result is a corrupted useless 1KB file... Cannot figure out what causes this.

Any ideas??

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.