M
Mark Seger
I have a testing environment that is set up in such a way that after
logging into the PC, a window is displayed that waits for the user to
hit the ENTER key and then automaticall starts running a canned set of
tests. This system also has rcmd set up on it for doing various mgmt
tasks such as rebooting it. What I'd like to do is use rcmd to remotely
run a local program that sends the ENTER to the system and so remotely
start the tests running.
So, having discovered GuiTest, I wrote a very simple script that looks
for the window named 'Test' that's waiting on the the ENTER key, selects
it and does a SendKey of {ENTER}. Works great when testing it locally
on that test machine but when I run it remotely via rcmd the call that
sets the foregoround window fails.
My initial thought is that the reason is because the script isn't
associated with any windows and therefore may not have the appropriate
context to find any other windows. To test this I used rcmd to simply
create an 'at' job but when that kicked off it too failed. I also tried
running the script via "cmd /c scriptname" to give it a windows context
but that fails too. Anybody ever see this sort of behavior before?
Here's what my script looks like, with the line of code that tells me
'$window' is undefined. This only happens when run via rcmd.
#!/usr/bin/perl
use strict;
use warnings;
use Win32::GuiTest qw(FindWindowLike SendKeys SetForegroundWindow);
my ($window) = FindWindowLike(0, '^Test');
print "Can't find window!!!\n" if !defined($window);
SetForegroundWindow($window);
SendKeys('{ENTER}');
-mark
logging into the PC, a window is displayed that waits for the user to
hit the ENTER key and then automaticall starts running a canned set of
tests. This system also has rcmd set up on it for doing various mgmt
tasks such as rebooting it. What I'd like to do is use rcmd to remotely
run a local program that sends the ENTER to the system and so remotely
start the tests running.
So, having discovered GuiTest, I wrote a very simple script that looks
for the window named 'Test' that's waiting on the the ENTER key, selects
it and does a SendKey of {ENTER}. Works great when testing it locally
on that test machine but when I run it remotely via rcmd the call that
sets the foregoround window fails.
My initial thought is that the reason is because the script isn't
associated with any windows and therefore may not have the appropriate
context to find any other windows. To test this I used rcmd to simply
create an 'at' job but when that kicked off it too failed. I also tried
running the script via "cmd /c scriptname" to give it a windows context
but that fails too. Anybody ever see this sort of behavior before?
Here's what my script looks like, with the line of code that tells me
'$window' is undefined. This only happens when run via rcmd.
#!/usr/bin/perl
use strict;
use warnings;
use Win32::GuiTest qw(FindWindowLike SendKeys SetForegroundWindow);
my ($window) = FindWindowLike(0, '^Test');
print "Can't find window!!!\n" if !defined($window);
SetForegroundWindow($window);
SendKeys('{ENTER}');
-mark