use Tk; use Win32; use Win32::OLE qw(EVENTS); $mw = new MainWindow (-title => "Application to replicate user data from web page"); # simple buttons to close IE or application $mw->geometry("350x100+200+200"); $mw->resizable(0,0); $customfont = "helvetica 10"; my $closeexlorerbutton = $mw -> Button(-text => "Close IE", -font => "fixed 10 bold", -height => "1", -width => "14", -command =>\&closeie) -> place(-x => 200, '-y' => 50); my $exitbutton = $mw -> Button(-text => "Cancel", -font => "fixed 10 bold", -height => "1", -width => "14", -command =>\&exitProgram) -> place(-x => 50, '-y' => 50); # open browser window and navigate to URL my $URL = "http://www.google.co.uk"; $IE = Win32::OLE->new("InternetExplorer.Application") || die "Could not start Internet Explorer.Application, Win32::OLE::LastError()\n"; Win32::OLE->WithEvents($IE,\&Event,"DWebBrowserEvents2"); $IE->{visible} = 1; $IE->Navigate($URL); Win32::OLE->MessageLoop(); MainLoop; sub exitProgram { my $response = $mw -> messageBox(-message=>"Are you sure you want to exit?", -type=>'yesno', -icon=>'question'); if ( $response eq "yes" or $response eq "Yes" ) { exit; } }