dehhloki

IE Download Unification

11 posts in this topic

Hello guys and sorry if this question has been asked before.

I am trying to download a file in IE with AutoIt, by clicking on a html anchor tag. The download path is variable, because it depends on a Session Id and this path is residing on the javascript zone (Ex: <a onclick="someFunc()">), there is no href attribute to help me, so I cant use INetGet to download the file.

As the dialog boxes differs from one version of IE to another, has anyone created a general function to help download files in IE accross multiple versions? (Click "Save" -> Change folder -> Ok)

And if not, what do you guys suggest in my case?

Thanks already!

Share this post


Link to post
Share on other sites



Thanks for the reply JohnOne. :)

 

Unfortunately, I can't give this information to you, because it is a website which only telecomunnications companies have access in Brazil.

 

But let me try to explain in better.

 

I want to download a file in IE by clicking on a anchor tag, button, whatever. The problem is that, after I click on the link, there is a save dialog, that is different in each version of IE and I wanted to build a macro that works on different versions of IE to download that file to a folder.

 

And I can't use INetGet because the url is in the javascript, very well secured in a function scope, so I cant access its value.

What I want is a function or a sequence of commands that can easily download the file once the dialog is shown, independent of the IE version.

By now, I am creating IFs based on the IE version and trying different numbers of Tabs and Enters to do the job, but I feel that it is not very professional. :P

Sorry for the long answer. 

Share this post


Link to post
Share on other sites

Don't worry, many people have super secret websites they cannot divulge for all kinds of reasons. In fact a gentleman was here also from Brasil not long ago with almost the exact same question, and his own super secret web address.

1 person likes this

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Hahahaha, :D

 

There is nothing special actually, its a series of shitty websites that hold lists of phone numbers from blacklists by state.

 

 

Do you have a pro tip for internet downloads with autoit?

 

Thank you so much for your attention.

Share this post


Link to post
Share on other sites

Hmm, got it.

 

I didn't have this problem, but I will try this if it happens.

 

I will continue doing my non-professional approach and maybe if it gets better I will post the answer here.

 

Thank you.

 

 

Share this post


Link to post
Share on other sites

I made a quick (35 seconds) video to try to show you what my problem is.

 

My problem is with the dialog shown on 00:24, that is different in each version of IE and I don't know how to solve it other way.

I solve it with a series of Send("{TAB N}"), but it only works on my machine, not on my colleague's PC that uses IE11. :(

Share this post


Link to post
Share on other sites

Well,

I know that this is a poor solution, but I got something. What I do is check the version of IE and decide what to do next. The code is this one:

 

;Click on the Excel Export Button
_IEAction($oMenuExport, "click")
Sleep(500)
Send("{ENTER}")

;IE9 Path
if $versaoIE = "9." then
   ;Wait for some time and hope that the download window is there
   Sleep(10000)
   ; Go to the save button
   Send("{TAB 5}")
   Sleep(500)
   ; Select "Save as"
   Send("{DOWN 2}")
   Send("{ENTER}")
   ; Wait for save dialog
   WinWaitActive("Salvar")
   ;Go to the path input
   Send("{TAB 5}")
   Send("{ENTER}")
   ;Send the path I hold on a variable
   Send($caminhoDownload)
   Send("{ENTER}")
   Sleep(1000)
   ; Go to the file's name and send the name I want
   Send("{TAB 6}")
   Send($sDataAtual)
   ; Save the file
   Send("{ENTER}")
   ; If the file is duplicated, I have this workaround to replace the file
   Sleep(1500)
   Send("{LEFT}")
   Send("{ENTER}")
   Sleep(1500)
endif
;IE8 Path
if $versaoIE = "8." then
   ; Wait for the download or open file dialog
   WinWait("Download de Arquivos")
   ; Choose the option "Save"
   Send("{LEFT}")
   Sleep(500)
   Send("{ENTER}")
   ; Wait until save dialog is up
   WinWaitActive("Salvar")
   ;Go to the path input
   Send("{TAB 5}")
   Send("{ENTER}")
   ;Send the path I hold on a variable
   Send($caminhoDownload)
   Send("{ENTER}")
   Sleep(1000)
   ; Go to the file's name and send the name I want
   Send("{TAB 6}")
   Send($sDataAtual)
   ; Save the file
   Send("{ENTER}")
   ; If the file is duplicated, I have this workaround to replace the file
   Sleep(1500)
   Send("{LEFT}")
   Send("{ENTER}")
   Sleep(1500)
endif
;Close all IE instances
FecharTodosIE()

 

Share this post


Link to post
Share on other sites

I hope I can have some more time to build a better solution.

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