Sign in to follow this  
Followers 0
crashnet

Script Doesnt Work When Run As Scheduled Task

10 posts in this topic

Run("C:\Program Files\Microsoft Retail Management System\Store Operations\SOMANAGER.exe")

WinActivate("Login")

WinWaitActive("Login")

Send("{ESC}")

WinWaitClose("Store Operations Manager")

this script works fine if i execute the script or directly run the scheduled task. But if i disconnect from the TS session (I only have RDP access to the server) and let the task run by schedule, when i log back in the app is started but it has not exited (which ESC should trigger). It seems that the window does not gain focus when the script is executed by a scheduled task. Any advice?

thanks in advance

EB

Share this post


Link to post
Share on other sites



Run("C:\Program Files\Microsoft Retail Management System\Store Operations\SOMANAGER.exe")

WinActivate("Login")

WinWaitActive("Login")

Send("{ESC}")

WinWaitClose("Store Operations Manager")

this script works fine if i execute the script or directly run the scheduled task. But if i disconnect from the TS session (I only have RDP access to the server) and let the task run by schedule, when i log back in the app is started but it has not exited (which ESC should trigger). It seems that the window does not gain focus when the script is executed by a scheduled task. Any advice?

thanks in advance

EB

You could try using ControlSend but I am not sure if that would work. I seem to recall reading somewhere that Windows does not allow the sending of keys when no-one is logged on.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Share this post


Link to post
Share on other sites

You could try using ControlSend but I am not sure if that would work. I seem to recall reading somewhere that Windows does not allow the sending of keys when no-one is logged on.

:)

Don't think its possible to run a AutoIt3 programs that interacts with program Windows in a disconnected TS session.


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

:think:

Don't think its possible to run a AutoIt3 programs that interacts with program Windows in a disconnected TS session.

the program actually runs, but it doesnt get the focus so that the ESC key can be sent, and therefore it never exits. this is the same problem i ran into when using wscript to accomplish this task... i thought AutoIt would be able to do this. i am very puzzled.

thanks

crash

Share this post


Link to post
Share on other sites

the program actually runs, but it doesnt get the focus so that the ESC key can be sent, and therefore it never exits. this is the same problem i ran into when using wscript to accomplish this task... i thought AutoIt would be able to do this. i am very puzzled.

thanks

crash

Understand that the script will run when it is scheduled, but i doubt that it will be able to interact with the sessions opened program windows.

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Understand that the script will run when it is scheduled, but i doubt that it will be able to interact with the sessions opened program windows.

ok. so that is my problem then. do you have any suggestions?

thank you for your attention :)

Share this post


Link to post
Share on other sites

Sorry, I don't have a solution for you. I have experienced the same problem - a script launched overnight by windows sched task never made it past the 1st "winwaitactive" despite the fact the window was clearly active. I've used autoit for years, and tried various workarounds w/o luck before giving up. Maybe I'll check some more...

Share this post


Link to post
Share on other sites

Sorry, I don't have a solution for you. I have experienced the same problem - a script launched overnight by windows sched task never made it past the 1st "winwaitactive" despite the fact the window was clearly active. I've used autoit for years, and tried various workarounds w/o luck before giving up. Maybe I'll check some more...

thanks for your reply. i guess i will have to try to find a different workaround for my problem.

Share this post


Link to post
Share on other sites

thanks for your reply. i guess i will have to try to find a different workaround for my problem.

Just a suggestion, if the window is open it should show up as a process. Why not wait for that process and close it?

Share this post


Link to post
Share on other sites

Just a suggestion, if the window is open it should show up as a process. Why not wait for that process and close it?

i didnt think that was going to work, but it does achieve the desired effect as far as making the app stamp the DB it connects to. thats what i needed, so THANK YOU.

i will be learning and using autoit from now on.

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