Sign in to follow this  
Followers 0
dsteinschneider

Script stops only when disconnected from Remote Desktop session

7 posts in this topic

I'm new to autoIT but like what I've been able to accomplish so far.

I am using Remote Desktop to develop this script (and it will run off task scheduler on the same machine). We leave the RDP session running and connect to it when we need to use the machine. The below script works fine if I'm connected but when I disconnect it stops on the second step line.

Any assistance with this will much appreciated. Thanks in advance

Run("C:\Program Files\Seagate Software\Crystal Reports\crw32.exe")

WinWait("Crystal Reports")

Send("{ALTDOWN}f{ALTUP}o")

WinWait("Open")

Send("C:\GM_APLUS\Reports\ADMIN GoldMine Project.rpt{ALTDOWN}o{ALTUP}{ENTER}")

WinWait("Crystal Reports - [ADMIN GoldMine Project.rpt]")

Send("{ALTDOWN}f{ALTUP}pe{ENTER}{ENTER}")

WinWait("Choose export file")

Send("{HOME}C:\Admin\{ENTER}{ENTER}")

WinWait("Crystal Reports - [ADMIN GoldMine Project.rpt]")

WinWaitClose("Exporting Records")

Sleep(3000)

Send("{F10}fx")

Share this post


Link to post
Share on other sites



As far as I know, Remote Desktop locks the system upon disconnect.

WinWait won't work on a locked system.

There is a blurb in the help file for Remote Desktop about disconnecting without ending a session:

To disconnect without ending a session

In the Remote Desktop Connection window, click Start, and then click Shut Down.

The Shut Down Windows dialog box appears.

Click Disconnect, and then click OK.

...but that option is not available to me on XP Pro SP2, so I cannot test. (When I click Start, "Shut Down" is not an option. Perhaps the help file for Remote Desktop has not been updated since pre-SP2 when multiple RD sessions were allowed.)

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

As far as I know, Remote Desktop locks the system upon disconnect.

WinWait won't work on a locked system.

That is true, I wasn't thinking about the fact the system is locked when you disconnect. In fact it starts running sometimes when I connect again. This is an XP Pro SP2 machine. Can I replace winwait with sleep and plenty of time for window to appear or are other things impacted by locked machine? Not ideal but I'm trying to automate crystal report generation at night for several reports on a small system where report server would be too expensive.

Thanks,

Doug

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

...Can I replace winwait with sleep and plenty of time for window to appear or are other things impacted by locked machine?

I'm not sure... but if the computer is in a secure location (and if allowed), just don't lock the system. Do not use Remote Desktop and no screen savers. Any of the VNC flavors should allow for remote connection/control with the option to disconnect without locking. Edited by herewasplato

[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
Share on other sites

use vnc / no screen saver

Minor nit.. I don't think the screensaver would come into play - if the scripts running and moving windows around, the screensaver isn't going to be activated...

More importantly,

If you're going to try to run any au3 script w/o an attached console, you are limited to commands that do not depend on the presence of the console (and of course, user input) -- essentially, you lose the Win...() functions, Input and Msg boxes, and so forth. If you can code what you need w/o using those Functions, i.e. use COM calls to manipulate Crystal Reports instead of the WinWait(), you should be good to go.

To handle the "locked" issue , you can use srvany.exe to install your compiled au3 app as a service, subject to the aforementioned constraints.

And, of course, you can agitate in the ideas forum for CONSOLE and SERVICE compiler options to be added to the au3 compiler.


Reading the help file before you post... Not only will it make you look smarter, it will make you smarter.

Share this post


Link to post
Share on other sites

Thanks for all the ideas. I'll report back here to let you know what works. The VNC idea is probably the best in this situation as the machine is two hours from my office.

Share this post


Link to post
Share on other sites

Minor nit.. I don't think the screensaver would come into play - if the scripts running and moving windows around, the screensaver isn't going to be activated...

I should have clarified that I was thinking about a screensaver that requires a password upon resume. The OP said it would be a scheduled task - I assumed that the screensaver would come on... so one could just uncheck the password on resume option, or not have a screensaver and just turn off/disconnect the monitor.

dsteinschneider,

I would have multiple ways to get into the system. VNC can stop responding at times... if it does, go to Remote Desktop and restart the system... having it auto logon to the "user" that is going to run your script. Also, setup the system to come back on after power failures - but you knew all of that :-)


[size="1"][font="Arial"].[u].[/u][/font][/size]

Share this post


Link to post
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
Sign in to follow this  
Followers 0