cwem Posted June 5, 2009 Share Posted June 5, 2009 My automation is to navigate to a web page and from which ID's are retrieved to create href's for file download. The problem is: for the 1st download, it works perfectly. For the 2nd one, I have to click "Save" myself in the File Download Window, and then the Save as window can still accomplish. Then no more file download window shows up, and the program does not exit with any error neither. It seems to be waiting for something. In another scenario, if I don't click it in the case of "the 2nd one", i may have to wait for around 10 min, during which I continue to work on other windows and come back to this file download window again, it then works properly again for 1 time and then the same problem occurs again and the same solution can still apply if one is patient enough. My codes are as follows: WinWaitActive("File Download") WinActivate("File Download") ControlClick("File Download", "Do you want to open or save", "&Save") WinWaitClose("File Download") WinActivate("Save As") ControlClick("Save As", "Save &in", "&Save") WinWaitClose("Save As") The file to download is of size about 4MB According to Autoit window tool, should i focus on "text" instead of "visible text" for ControlClick? Link to comment Share on other sites More sharing options...
Triblade Posted June 5, 2009 Share Posted June 5, 2009 You know the WinWaitClose waits for the download window to be gone right? My active project(s): A-maze-ing generator (generates a maze) My archived project(s): Pong3 (Multi-pinger) Link to comment Share on other sites More sharing options...
cwem Posted June 6, 2009 Author Share Posted June 6, 2009 You know the WinWaitClose waits for the download window to be gone right?But aren't the following 2 lines ensure the window will be closed? (assume no overwrite/write failure occurs)WinActivate("File Download") ControlClick("File Download", "Do you want to open or save", "&Save") Link to comment Share on other sites More sharing options...
Triblade Posted June 6, 2009 Share Posted June 6, 2009 Depends on the download speed. If the download takes 10 minutes to complete... You get the picture. My active project(s): A-maze-ing generator (generates a maze) My archived project(s): Pong3 (Multi-pinger) Link to comment Share on other sites More sharing options...
cwem Posted June 7, 2009 Author Share Posted June 7, 2009 Depends on the download speed. If the download takes 10 minutes to complete... You get the picture.the download usually finishes withing 30sec once it starts. what else info should i provide that may facilitate understanding of this problem? thanks again for your advice~ Link to comment Share on other sites More sharing options...
FreeFry Posted June 7, 2009 Share Posted June 7, 2009 So you have a program, that collects the links to the files? If that's the case, why not just use InetGet ? Link to comment Share on other sites More sharing options...
cwem Posted June 7, 2009 Author Share Posted June 7, 2009 So you have a program, that collects the links to the files?If that's the case, why not just use InetGet ?The problem is that the server side doesn't provide direct links for me to download files. I have to emulate the clicking process in order to retrieve the files... Link to comment Share on other sites More sharing options...
FreeFry Posted June 7, 2009 Share Posted June 7, 2009 I see.. Are you using internet explorer for this? Link to comment Share on other sites More sharing options...
Triblade Posted June 7, 2009 Share Posted June 7, 2009 What I allways do in this kinda situation is putting useless msgbox's after 'important' points in the code. Try putting in a msgbox before and after winwait and winactivate. Then put a number in every msgbox to see what the last action was. This way you should be able to 'see' where the code is. The other way is to not use msgbox's but ConsoleWrite - and look into the console in SciTe. My active project(s): A-maze-ing generator (generates a maze) My archived project(s): Pong3 (Multi-pinger) Link to comment Share on other sites More sharing options...
cwem Posted June 8, 2009 Author Share Posted June 8, 2009 I see..Are you using internet explorer for this?Yes, I am using IE7 Link to comment Share on other sites More sharing options...
cwem Posted June 8, 2009 Author Share Posted June 8, 2009 What I allways do in this kinda situation is putting useless msgbox's after 'important' points in the code.Try putting in a msgbox before and after winwait and winactivate. Then put a number in every msgbox to see what the last action was. This way you should be able to 'see' where the code is. The other way is to not use msgbox's but ConsoleWrite - and look into the console in SciTe.Following your advice, I once added some MsgBoxes in between but finally I had to remove them because they steal the focus of active window. In fact I can be quite sure it's due to the fact that WinActivate and ControlClick don't do its job properly. WinWaitActive("File Download") MsgBox(0, "Link url1", $url) WinActivate("File Download") ControlClick("File Download", "Do you want to open or save", "&Save") ;MsgBox(0, "Link url2", $url) WinWaitClose("File Download") MsgBox(0, "Link url3", $url)ControlClick cannot click the save button automatically because it somehow loses its focus. As mentioned in the 1st post, I have to wait for some time (immediately activate the File Download window to make it in focus doesn't work), then ControlClick then knows to do its job... Link to comment Share on other sites More sharing options...
FreeFry Posted June 8, 2009 Share Posted June 8, 2009 If you're using IE, you could use the _IE UDF to automate it, you could most likely collect the links of the webpage that way, and do direct downloads - unless there's like cookies n crap involved... 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