Sign in to follow this  
Followers 0
Alodar

A more elegant solution?

6 posts in this topic

Currently, I create an IE object hidden, and download various files by navigation to links. Because the file is not actually visible to me, and is generated by a script on mouse userclick, I get around the internet explorer security bar by navigating to the link rather than simulating a mouseclick. This works very well in all regards save one: the download box. The download box comes up asking to save or open the file, and then waits while downloading the file, and I cannot find an elegant solution to this. I'd much prefer it if the user didn't have to see it at all, and could not interact with it and thus accidentaly close it or cancel it. IE download windows are not consistently their own true 'window' however, nor is it the same window handle from the 'Open, Save, Cancel' option to the downloading window to the download completed window, so I cannot find it as a window handle and hide it. It doesn't help that I also rename the file. I would use INETGET() if I could, but because the file doesn't actually exist, simulating a mouseclick on the link (it's a csv export btw) creates the security bar popup, and inetget returns no data, even after 3 hours of waiting (I had hope, and lunch).

Anyone have any ideas? Much appreciated.

Share this post


Link to post
Share on other sites



$sStr = BinaryToString(InetRead("http://www.autoitscrip.com"))


George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Share this post


Link to post
Share on other sites

$sStr = BinaryToString(InetRead("http://www.autoitscrip.com"))

That has the same issue as InetGet sadly. There is no real filename at the link. It's a php (I think?) script that runs something in the background. The actual link is something like <http://serveraddress/f?p=2355:2345234552:FLOW_EXCEL_OUTPUT_R25256523_en-us (not the real numbers, but might as well be for all the meaning they have).

So that link returns no data to InetRead or to InetGet, and I'm not experienced enough to know what it actually does. My best guess is that it initiates a server side push of something that IE interprets as a download in a seperate connection or something, but frankly that's pure speculation.

Share this post


Link to post
Share on other sites

I use INetRead to download CVS files from my bank which accepts an url containing a start and end date. Unless they keep a file for each possible date combination in the last 6 years this should work the same as the system you describe.

What I suspect is that INetRead is failing, because you need to be logged into something before downloading and INetRead is run from a different process than your IE window. If this is the case a solution might be to use an embedded IE window to log in and INetRead to download.

If this doesn't help and you don't need to log in anywhere it might help if you shared the script and website with us.

Share this post


Link to post
Share on other sites

So, after playing around with it some more, I found something out. InetRead and InetGet DOES work...however on many of them (all of the ones I was trying apparantly) there is a large delay in the beginning while the file is 'prepared' or something. I.e. you click on the link, and then wait up to 30 to 40 seconds and then the download starts and takes even longer. This is not true on the shorter files where it is only returning a thousand records, rather than the major ones where there are 10k+.

What I suspect is that INetRead is failing, because you need to be logged into something before downloading and INetRead is run from a different process than your IE window. If this is the case a solution might be to use an embedded IE window to log in and INetRead to download.

If this doesn't help and you don't need to log in anywhere it might help if you shared the script and website with us.

Using an embedded IE window with DID work, even with InetGet. I'm logged in to a VPN, but I'm not logging in to something overtly. A cookie maybe? This really helped. Now I just need to get used to the GUI I suppose. I haven't ever used an application that used the GUI because I always make things that have no user interaction. I need to work on making an invisible (and extremely minimal) GUI that has no controls and is not visible to the user so that they really only see the progress bar.

Thanks so much for the direction!

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Removing this because I fixed it; the error was mine. The embedded IE solution worked. Thanks a lot Tvern!

Edited by Alodar

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0