Jump to content

WinActivate fails with Remote Desktop minimized


Recommended Posts

Hi,

I have an Autoit script that gets run when I vist a URL. I am running Tomcat as a web server, in a user account. When my servlet is visited, I launch the EXE I created with Autoit. This script in turn automates a bunch of tasks, launches a program & controls it etc. It is a server machine, a Windows 2003. I control it via Remote Desktop.

If I use while Remote Desktop is open, fully maximized or not, things work fine.

However, if I minimize the Remote Desktop window and try again, it then fails. I have tried WinActivate followed by a WinWaitActive with a timeout, and that fails. I have also tried a loop, 40 times, calling WinActivate and testing WinActive (and sleeping 250 in the loop between retries) and I get the same error - can never activate the window for the EXE I just launched from my script.

If I disconnect Remote Desktop and leave the user account running, it also fails.

Is there a way to make this scenrio work? Thanks,

marcio

Link to comment
Share on other sites

Everything I have tried in regards to using Remote Desktop that relies on WinActivate or WinWaitActive has failed me.

As best as I can tell, if you do not have Remote Desktop selected as the active window then as far as that computer (and AutoIt then too) are concerned, it might as well not be turned on.

An alternative to this is to use VNC instead of Remote Desktop... Instead of actually locking the computer and showing you the session, VNC just pulls the graphical view of the screen, while the computer remains logged in normally. A Google search will turn up quite a few implementations of it. The problem with VNC is that it's not the most secure thing in the world out of the box, but if you need to make it secure you could tunnel it through SSH, which you can get for Windows by Googling OpenSSH for Windows.

Edited by exodius
Link to comment
Share on other sites

Thanks for the suggestion. I have used VNC in a distant past.

So, I downloaded it and tried. Things work even after I disconnect... but only for a while. After an interval, it will fail the same way after the VNC client disconnects.

With Remote Desktop it starts failing as soon as I minimize or as soon as I disconnect (even though in theory the account is still open & running all the GUI programs I left running). So, VNC is slightly better but eventually both have the same fate: they screw Autoit big time.

So, any other suggestion? Maybe it is a trick in the VNC server config? Maybe I should try one of the other VNC implementations ? I was using realVNC.

Any chance AUtoit could be fixed or is this a technical impossibility? Any other tools that work with Remote Desktop after a disconnection?

Related: I have noticed that if I run Tomcat as a service it fails always, even when I am connected via Remote Desktop or right at the console. I was only able to get things to work by launching Tomcat from a user account and leaving that acocunt open. Then the autoit servlet launched by the script can interact with th elaunched program. But upon Remote Desktop connection, it is almost lik egetting the "tomcat as a service" problem back.

I'd actually prefer to have Autoit work in the as-a-service scenario, in case anybody has tips. Thanks,

marcio

Link to comment
Share on other sites

No, it is a server machine. Sempron 3100+ running Win2003.

Actually... It is a virtualized OS. It is running under Microsoft VirtualServer2005R2. Do you think it could be VirtualServer2005R2 making the OS run in slow mode? Note that I can still connect to it at any time, so I doubt it is being frozen by VirtualServer2005R2.

Link to comment
Share on other sites

I'm not sure about that setup... I know that I scripts that run on my other desktop (Windows XP) that runs entirely headless all the time that never have any problem. Although if you're running on a virtual OS I'm not sure what differences could cause a problem.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...