Send Keys Question
- I am trying to use the sendkeys function from within a perl TK
program. If the window that I am sending the keystokes to is not the
active window, the keystrokes are not received. If it is the active
window, it works fine.
I installed via PPM this module today. It looks like what is in the
repository is version .9 not the latest 1.3.
I tried adding the line
to the code below to see if this would bring the destination window
to the top. But it does not.
Is the any documentation for these extra functions?
use Win32::GuiTest qw(FindWindowLike GetWindowText
SetForegroundWindow SendKeys ShowWindow);
$window = FindWindowLike (0,$title)
--- In perlguitest@y..., "pc210018" <pc210018@n...> wrote:
> I installed via PPM this module today. It looks like what is in
> repository is version .9 not the latest 1.3.
Sounds strange. The ppm installer uses the local .tar.gz file that
comes with the distribution. I just downloaded from cpan and the .pm
file inside the .tar.gz file says 1.3, so I'd say the distribution
looks ok. Any chance your problem is caused by something else?
> I tried adding the line
> to the code below to see if this would bring the destination window
> to the top. But it does not.
> Is the any documentation for these extra functions?
No. I'm working on it, but mostly the "documentation" is the sample
programs in the "eg" directory.
> $title='Remedy User.*';
> $window = FindWindowLike (0,$title)
> SendKeys("Starting Order");
My guess is you're working on Windows 2000.
MS changed the way SetForegroundWindow works: in previous versions of
the OS, if you had a menu open and a program/window comes to the
foreground, the menu closes, which a lot of people found anoying. In
W2000 the window doens't actually become the foreground window,
instead the icon in the taskbar starts to flash...
This is bad for SendKeys and at the moment, the only way I've found
around it is to use SendKeys to send ALT+TAB get 2000 to switch
windows this way...
just looked up some links that describe this problem:
INFO: SetActiveWindow() and SetForegroundWindow() Clarification
INFO: Changing the Foreground Window in Windows 98 and Windows 2000