Sign in to follow this  
Followers 0
codalith

IE File Download

6 posts in this topic

Newbie alert!

Still coming up to speed and trying to learn why things are the way they are...

;some set up code here gets us to the File Download Dialog ...

;File Download Dialog
WinWaitActive("File Download")

; Attempt 1
;Send("!S") - doesn't work

; Attempt 2
;Send("+{TAB}") ; Shift+TAB, Move Focus left to Save
;Send("{ENTER}") ; Nope, this also doesn't work.

; Attempt 3 
MouseMove(X, Y, 20) ; for suitable values of X and Y
MouseClick("left") ; Finally! This works

;"Save As" Dialog
WinWaitActive("Save As", "&Save")
Send("!S") ; no problem to use !S here

;"Confirm Save As" Dialog
WinWaitActive("Confirm Save As", "&Yes")
Send("!Y")

;"Download complete" Dialog
WinWaitActive("Download complete", "Close")
Send("{ENTER}")
; -------------------------------

I would prefer to use Send("!s") instead of a mouseclick to make the script independent of the X,Y co-ords, but, for the File Download dialog, these just don't work for the Save button.

AutoIt is great. It makes a lot of things simple that other tools make a meal out of, so I don't mind paying my dues, I already know the payback is worth it. So, where's the smart place to go to find more of these quirks? As great as this forum is, if there is anything on this topic it's buried in noise.

Share this post


Link to post
Share on other sites



You can use the InetGet or the InetRead function in .au3 to download files from websites, and save it to your hard drive,

eliminating the need to open up and automate a web browser to download a file.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

>You can use the InetGet or the InetRead function in .au3 to download files from websites, and save it to your hard drive, eliminating the need to open up and automate a web browser to download a file.

How do you use these when the site login sets http cookies?

(edit to fix lousy formatting)

Edited by codalith

Share this post


Link to post
Share on other sites

One way is use an embedded IE control. This works well if you want to use IE in the background anyways. I think it works because AutoIt becomes the parent process for IE, and as such id seen as logged in.

Another way is to drop IE and use the WinHttp UDF by trancexx. It's faster, uses less bandwidth amd cpu, but because it has no graphical interface of it's own it can be a bit harder to create the script.

There may be other ways.

Share this post


Link to post
Share on other sites

Newbie alert!

Still coming up to speed and trying to learn why things are the way they are...

;some set up code here gets us to the File Download Dialog ...

;File Download Dialog
WinWaitActive("File Download")

; Attempt 1
;Send("!S") - doesn't work

; Attempt 2
;Send("+{TAB}") ; Shift+TAB, Move Focus left to Save
;Send("{ENTER}") ; Nope, this also doesn't work.

; Attempt 3 
MouseMove(X, Y, 20) ; for suitable values of X and Y
MouseClick("left") ; Finally! This works

;"Save As" Dialog
WinWaitActive("Save As", "&Save")
Send("!S") ; no problem to use !S here

;"Confirm Save As" Dialog
WinWaitActive("Confirm Save As", "&Yes")
Send("!Y")

;"Download complete" Dialog
WinWaitActive("Download complete", "Close")
Send("{ENTER}")
; -------------------------------

I would prefer to use Send("!s") instead of a mouseclick to make the script independent of the X,Y co-ords, but, for the File Download dialog, these just don't work for the Save button.

AutoIt is great. It makes a lot of things simple that other tools make a meal out of, so I don't mind paying my dues, I already know the payback is worth it. So, where's the smart place to go to find more of these quirks? As great as this forum is, if there is anything on this topic it's buried in noise.

Hi,

Did you solve this problem? I am having the same problems with my script...

Thanks, Alma

Share this post


Link to post
Share on other sites

Hi,

Did you solve this problem? I am having the same problems with my script...

Thanks, Alma

may be you can try this:

while (True)
  
WinWaitActive("File Download")
 Sleep(1000)
 WinWaitActive("Save As")
 Send("{Enter}")
 Sleep(500)
 Send("!y") 
 WinWaitActive("Download complete", "Close")
 WinActivate(
 Send("{ENTER}")
WEnd

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