I use a combination of Win32::Setupsup and Win32::GUI.  This seems to work
just fine with Windows 2000.

use Win32::GUI;
use Win32::Setupsup;
if ($windowid=GUI::FindWindow( '', $wintitle))
        {
        GUI::Show($windowid);
        GUI::SetForegroundWindow($windowid);
        Win32::Setupsup::SendKeys($windowid, "stuff to send",1) ;
        }

The Show() is only necessary if the window might be hidden.

Hope this helps!

-----Original Message-----
From: Tom [mailto:[EMAIL PROTECTED]]
Sent: Sunday, June 17, 2001 3:00 AM
To: Michael Mirman; [EMAIL PROTECTED]
Subject: Re: Setupsup and Win2000


here is a script i popped out that works around the window focus problem

(note: i didn't spend much time on this.....it needs some work)



anyhow, the basic idea is, it sends the keys, then checks and sees if the
window is still there

if it is, it sends the keys again..and so forth



---tom





*********** REPLY SEPARATOR  ***********



On 6/17/2001 at 4:41 AM Michael Mirman wrote:



>I have a script that uses Setupsup and sends keystrokes to a specific
window.

>First, it calls WaitForWindow to get focus, then it sends keystrokes.

>After I've moved to Win2K, I've noticed that when my machine is unattended,

>everything seems to be working fine.

>However, if I'm doing something, my focusing on different windows easily

>confuses Setupsup.

>

>There is something different between Win2K and NT4 how they focus windows.

>I see on the tools bar, the window that the script tries to get focus on

>starts blinking.

>However, the focus really stays on the window I'm working in, so the

>keystrokes are sent to that window, rather to the one that the script
intended.

>

>Any win2k insights?

>--

>Mike Mirman                            Tel: (508) 647-7555

>The Mathworks, Inc.                    FAX: (508) 647-7013

>3 Apple Hill Drive, Natick, MA 01760

>mailto:[EMAIL PROTECTED]           Web: http://www.mathworks.com

>

>_______________________________________________

>Perl-Win32-Admin mailing list

>[EMAIL PROTECTED]

>http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin





_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

Reply via email to