I have an experimental Perl script that selects a Notepad window and writes some text to it. My code works.
If I have more than one Notepad window open, I would like to be able to manually select which window to write to. Is there a way to do this?
#!/PERL5
use strict;
use Win32::GuiTest qw(FindWindowLike SetForegroundWindow SendKeys);
$ARGV[0] =~ s/\[!20\]//g; #Remove [!20] WinkeySim delays
$ARGV[0] =~ m!\((.*)\)!; #Grab everything between ( ) put i
+nto $1
my $EEcorr = "{(}".$1."{)}"; #Parentheses (special characte
+rs) are added
#Write to unit EEPROM
#my @window = FindWindowLike(0, "Terminal", "");
my @window = FindWindowLike(0, "Notepad", "");
SetForegroundWindow($window[0]);
sleep 1;
Win32::GuiTest::SendKeys($EEcorr,20);