neilontherock Posted December 17, 2008 Share Posted December 17, 2008 (edited) Hi, love the tool but can someone explain to me. The only difference in the 2 code snippets is the URL and the HTTP control that is clicked. The Perl code works and the file downloads fine. my $ie = Win32::IEAutomation->new( visible => 1, maximize => 1); $ie->gotoURL('http://search.cpan.org/~prashant/Win32-IEAutomation-0.5/lib/Win32/IEAutomation.pm'); $ie->getLink('linktext:', 'Source')->Click; my $autoit = Win32::OLE->new('AutoitX3.Control'); $autoit->WinWait('File Download', '', 5); $autoit->ControlClick('File Download', '', '&Save'); $autoit->WinWait('Save As', 'Save &in', 5); $autoit->ControlSetText('Save As', 'Save &in', 'Edit1', 'C:\Downloaded Ie Files\IE.csv'); $autoit->ControlClick('Save As', 'Save &in', '&Save'); $autoit->WinClose('File Download'); $ie->closeIE; and this code does not; The save button on the Download dialog do not fire. my $ie = Win32::IEAutomation->new( visible => 1, maximize => 1); $ie->gotoURL('http://finance.yahoo.com/q?s=IBM'); $ie->getLink('linktext:', 'Download Data')->Click; my $autoit = Win32::OLE->new('AutoitX3.Control'); $autoit->WinWait('File Download', '', 5); $autoit->ControlClick('File Download', '', '&Save'); $autoit->WinWait('Save As', 'Save &in', 5); $autoit->ControlSetText('Save As', 'Save &in', 'Edit1', 'C:\Downloaded Ie Files\IE.csv'); $autoit->ControlClick('Save As', 'Save &in', '&Save'); $autoit->WinClose('File Download'); $ie->closeIE; Edited December 17, 2008 by neilontherock Link to comment Share on other sites More sharing options...
PsaltyDS Posted December 17, 2008 Share Posted December 17, 2008 Hi, love the tool but can someone explain to me. The only difference in the 2 code snippets is the URL and the HTTP control that is clicked.The Perl code works and the file downloads fine. my $ie = Win32::IEAutomation->new( visible => 1, maximize => 1); $ie->gotoURL('http://search.cpan.org/~prashant/Win32-IEAutomation-0.5/lib/Win32/IEAutomation.pm'); $ie->getLink('linktext:', 'Source')->Click; my $autoit = Win32::OLE->new('AutoitX3.Control'); $autoit->WinWait('File Download', '', 5); $autoit->ControlClick('File Download', '', '&Save'); $autoit->WinWait('Save As', 'Save &in', 5); $autoit->ControlSetText('Save As', 'Save &in', 'Edit1', 'C:\Downloaded Ie Files\IE.csv'); $autoit->ControlClick('Save As', 'Save &in', '&Save'); $autoit->WinClose('File Download'); $ie->closeIE;and this code does not; The save button on the Download dialog do not fire. my $ie = Win32::IEAutomation->new( visible => 1, maximize => 1); $ie->gotoURL('http://finance.yahoo.com/q?s=IBM'); $ie->getLink('linktext:', 'Download Data')->Click; my $autoit = Win32::OLE->new('AutoitX3.Control'); $autoit->WinWait('File Download', '', 5); $autoit->ControlClick('File Download', '', '&Save'); $autoit->WinWait('Save As', 'Save &in', 5); $autoit->ControlSetText('Save As', 'Save &in', 'Edit1', 'C:\Downloaded Ie Files\IE.csv'); $autoit->ControlClick('Save As', 'Save &in', '&Save'); $autoit->WinClose('File Download'); $ie->closeIE;Using the text from the button for Control ID is wrong. Your control ID of '&Save' is invalid, so you are only lucky that it happens to be the default focus in the first instance, and must not be in the second. Use AU3Info.exe to get better control ID for the buttons.Also, this topic looks like it should have been opened in the AuotItX Forum. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
neilontherock Posted December 19, 2008 Author Share Posted December 19, 2008 Thanks for your suggestion. I tried this and it still does not fire the Save button. I used the Window Info tool to get the control ID of the button and put that in the ControlClick. Still doesn't work. Using the Windows Info tool it appears that the File Download dialog is not the active window. Tried forcing it to be the Active window and that didn't work either. 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