On 19 September 2011 10:20, Edwards, Mark (CXO) <mark.r.edwa...@hp.com>wrote:

>
> I have a simple Win32::GuiTest example where I find a Notepad window, print
> its handle and title and then send some keys to it.   When I open Notepad
> and the run the script I see...
>
> 4915356: Untitled - Notepad
>  Notepad pops up on top of other windows and "Testing 123" shows up in
> Notepad as expected.
>
> Here's the problem.  I need this to work with the screen locked.  When I
> lock the screen and give it time to run, I still get the handle and window
> title but no keys get sent to Notepad.  It seems like it never get set as
> the foreground window since it's not on top after I unlock the screen.
>
> I tried SetForegroundWindow, SetActiveWindow and SetFocus but none seems to
> make it the current window.
>
> Any suggestions?
>
>
> #################################################################################
> use warnings;
> use strict;
> use Win32::GuiTest qw(SetFocus SetActiveWindow FindWindowLike
> SetForegroundWindow SendKeys GetWindowText);
>
> sleep 15;  #Give me time to lock the screen
> my ($winid)=FindWindowLike(0, "Notepad");
> print "$winid: ", GetWindowText($winid), "\n";
> #SetForegroundWindow($wind);
> #SetActiveWindow($winid);
> SetFocus($winid);
> sleep 3;
> SendKeys("Testing 123~");
>
>

Based on what I googled it seems that when the screen is locked no window
can be set to active - it's a security feature.

I guess for the sake of this post you've dumbed it down, but what exactly
are you trying to do? There may be other ways rather than GuiTest  . . .

Just in
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to