dehhloki Posted December 28, 2015 Share Posted December 28, 2015 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! Link to comment Share on other sites More sharing options...
JohnOne Posted December 28, 2015 Share Posted December 28, 2015 I suggest you post the link to the web page. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
dehhloki Posted December 28, 2015 Author Share Posted December 28, 2015 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. Sorry for the long answer. Link to comment Share on other sites More sharing options...
JohnOne Posted December 28, 2015 Share Posted December 28, 2015 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. dehhloki 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
dehhloki Posted December 28, 2015 Author Share Posted December 28, 2015 Hahahaha, 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. Link to comment Share on other sites More sharing options...
JohnOne Posted December 28, 2015 Share Posted December 28, 2015 I believe a save as dialogue sometimes blocks script, so you might need to spawn a separate script to deal with it. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
dehhloki Posted December 28, 2015 Author Share Posted December 28, 2015 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. Link to comment Share on other sites More sharing options...
JohnOne Posted December 28, 2015 Share Posted December 28, 2015 It should not hurt to show your code, just alter the url, or better still, find a public site with same thing.It will allow people to advise without guessing or posting code you already tried. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
dehhloki Posted December 29, 2015 Author Share Posted December 29, 2015 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. Link to comment Share on other sites More sharing options...
dehhloki Posted December 29, 2015 Author Share Posted December 29, 2015 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: expandcollapse popup;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() Link to comment Share on other sites More sharing options...
dehhloki Posted December 29, 2015 Author Share Posted December 29, 2015 I hope I can have some more time to build a better solution. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now