use strict; use warnings; use Win32::GuiTest qw(:ALL); my @window = FindWindowLike(undef, "Excel"); # die if Excel can't be found if (not @window) { die "Could not find Excel\n"; } # do stuff here