Script runs manually but fails when scheduled

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
jfloyd
Newbie
Posts: 3
Joined: Tue Aug 31, 2010 2:08 am

Script runs manually but fails when scheduled

Post by jfloyd » Tue Aug 31, 2010 2:29 am

Hello. I'm trying to debug a macro that was created for a server in v5.0.4. I've upgraded the server to v12.0.7 as a first step, but that has not solved the issue.

Basically there is a macro that runs nightly on a Win 2003 server, which remains logged on with no screen saver. When you run the macro manually it runs to completion with no issues. When scheduled, the macro fails at the SetFocus>Concurrent Scheduler* line because the window never gets opened by the ALT commands above.

Any suggestions as to why it won't work automatically? Thanks in advance. Code as follows:

//SCHEDULER BY ORDER NORM - SANDBOX
Run Program>D:\VISUAL\vmfg\VM.exe -d SANDBOX -U xxx -P xxx
Wait>15
SetFocus>VISUAL Enterprise*
Press ALT
SendText>u
SendText>h
Release ALT
Wait>5
SetFocus>Concurrent Scheduler*
Press DOWN
Press ALT
SendText>f
SendText>d
Release ALT
Wait>5
Press ALT
SendText>O
Release ALT
//Wait 15 minutes
Wait>900
CloseWindow>Concurrent Scheduler*
Wait>1
CloseWindow>VISUAL Enterprise*

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Tue Aug 31, 2010 4:16 am

Try using WaitWindowOpen> rather than attempting to wait for a fixed amount of time. If WaitWindowOpen> resolves the issue then you can adjust the wait times downward

Code: Select all

//SCHEDULER BY ORDER NORM - SANDBOX
Run Program>D:\VISUAL\vmfg\VM.exe -d SANDBOX -U xxx -P xxx

//Added WaitWindowOpen>
WaitWindowOpen>VISUAL Enterprise*
Wait>15
SetFocus>VISUAL Enterprise*
Press ALT
SendText>u
SendText>h
Release ALT

//Added WaitWindowOpen>
WaitWindowOpen>Concurrent Scheduler*
Wait>5
SetFocus>Concurrent Scheduler*
Press DOWN
Press ALT
SendText>f
SendText>d
Release ALT
Wait>5
Press ALT
SendText>O
Release ALT
//Wait 15 minutes
Wait>900
CloseWindow>Concurrent Scheduler*
Wait>1
CloseWindow>VISUAL Enterprise*

jfloyd
Newbie
Posts: 3
Joined: Tue Aug 31, 2010 2:08 am

Post by jfloyd » Tue Aug 31, 2010 2:04 pm

Thanks JRL. I gave it a try, and what seems to happen is that the 'VISUAL Enterprise' window never gets focus. Could this be someting to do with the desktop on the server being locked? I'm remoting in to do the work and then disconnecting to let the scheudle run.

That seems to be the case - I just left the session window open and let the macro kick-off, and it ran to completion just fine.

So how do I get the macro to run on a schedule if I remote into the server, and then close the session?

Thanks again.

Here is the log:

31/08/2010 09:26:00:711 - Started Macro : SANDBOX - SCHEDULER BY ORDER NORM
31/08/2010 09:26:00:726 - START: Run Program>D:\VISUAL\vmfg\VM.exe -d SANDBOX -U SYSADM -P SYSADM
31/08/2010 09:26:00:742 - END: Run Program>D:\VISUAL\vmfg\VM.exe -d SANDBOX -U SYSADM -P SYSADM
31/08/2010 09:26:00:742 - START: WaitWindowOpen>VISUAL Enterprise*
31/08/2010 09:26:05:836 - END: WaitWindowOpen>VISUAL Enterprise*
31/08/2010 09:26:05:836 - START: Wait>15
31/08/2010 09:26:20:836 - END: Wait>15
31/08/2010 09:26:20:836 - START: SetFocus>VISUAL Enterprise*
31/08/2010 09:26:20:836 - END: SetFocus>VISUAL Enterprise*
31/08/2010 09:26:20:851 - START: Press ALT
31/08/2010 09:26:20:867 - END: Press ALT
31/08/2010 09:26:20:867 - START: SendText>u
31/08/2010 09:26:20:867 - END: SendText>u
31/08/2010 09:26:20:883 - START: SendText>h
31/08/2010 09:26:20:883 - END: SendText>h
31/08/2010 09:26:20:883 - START: Release ALT
31/08/2010 09:26:20:898 - END: Release ALT
31/08/2010 09:26:20:898 - START: WaitWindowOpen>Concurrent Scheduler*
31/08/2010 09:41:15:758 - END: WaitWindowOpen>Concurrent Scheduler*

User avatar
Marcus Tettmar
Site Admin
Posts: 7395
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Aug 31, 2010 2:06 pm

Could this be someting to do with the desktop on the server being locked? I'm remoting in to do the work and then disconnecting to let the scheudle run.
Yes. When you log out of remote desktop the console is being locked. And windows do not get created on locked desktops. Therefore WaitWindowOpen/SetFocus etc will not see the window - it does not exist and cannot be controlled.

See:
http://www.mjtnet.com/msfaq171.htm
http://www.mjtnet.com/msfaq17.htm
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

jfloyd
Newbie
Posts: 3
Joined: Tue Aug 31, 2010 2:08 am

Post by jfloyd » Tue Aug 31, 2010 2:24 pm

OK - I'll get someone onsite to login and test.

Thanks for your help!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts