use Win32::IE::Mechanize; use Win32::GuiTest qw(FindWindowLike SetForegroundWindow SendKeys); my $ticker = 'INTC'; my $time = time(); my $filename = "$ticker-$time.txt"; my $ie = Win32::IE::Mechanize->new( visible => 1 ); $ie->get( "http://www.cboe.com/DelayedQuote/QuoteTableDownload.aspx" ); if ( fork ) { $ie->form_name( "QuoteTableDownload" ); $ie->set_fields( ticker => $ticker ), $ie->click_button( value =>'Download' ); print "Closing IE\n"; $ie->close; } else { my $window; sleep 1 until ($window) = FindWindowLike(0, "^File Download" ); print "Got $window\n"; SetForegroundWindow($window); SendKeys("{TAB}~"); sleep 1; SendKeys("$filename~"); }