odd behavior between Guitest and rcmd on windows

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
 
A

A. Sinan Unur

Mark Seger said:
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.

You should not assume that everyone knows what rcmd is. According to

http://www.microsoft.com/technet/archive/winntas/support/advtshoot/x0a_tool.mspx?mfr=true

it allows you to interact with a Windows service that allows you to
run commands remotely on a computer.

AFAIK, services don't automatically have the right to interact with the
desktop.

For your script, started using rcmd, to be able to interact with the
desktop, you'll need to set it up that way.

I don't know much about how to do that and as such this is not a Perl
problem.

You might find useful information at

http://support.microsoft.com/kb/327618

Sinan
 
M

Mark Seger

A. Sinan Unur said:
You should not assume that everyone knows what rcmd is. According to

http://www.microsoft.com/technet/archive/winntas/support/advtshoot/x0a_tool.mspx?mfr=true

it allows you to interact with a Windows service that allows you to
run commands remotely on a computer.

AFAIK, services don't automatically have the right to interact with the
desktop.

For your script, started using rcmd, to be able to interact with the
desktop, you'll need to set it up that way.

I don't know much about how to do that and as such this is not a Perl
problem.

You might find useful information at

http://support.microsoft.com/kb/327618

Sinan
Thanks, Sinan. I thought you might reply to me since I had originally
found some reponses you had made to a different poster on how to use
GuiTest. :cool:

Good suggestion about trying microsoft though I'm not hopeful as I
suspect it's real users who can help - but maybe a microsoft newsgroup
is the way to do. Meanwhile I can also use GuiTest to move the mouse to
a specific screen location, essentially putting it over the OK button,
and doing a mouse click. That may help, though I'm not really fond of it.

-mark
 
C

Csaba

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.
[snip]

AFAIK, services don't automatically have the right to interact with
the desktop.

For your script, started using rcmd, to be able to interact with the
desktop, you'll need to set it up that way.

Also, the service (and everything started from it) might have a
completely different desktop from the one containing the window with the
button you want to press. Try changing the account for the service to be
the same as the user logged in interactively.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,898
Latest member
BlairH7607

Latest Threads

Top