rd48sec has asked for the wisdom of the Perl Monks concerning the following question:
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);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Manually Select a Windows Window
by LanX (Saint) on Feb 21, 2017 at 17:18 UTC | |
|
Re: Manually Select a Windows Window
by stevieb (Canon) on Feb 21, 2017 at 17:19 UTC | |
by rd48sec (Novice) on Feb 21, 2017 at 17:48 UTC | |
by Anonymous Monk on Feb 22, 2017 at 00:15 UTC |