Jump to content

Script Doesnt Work When Run As Scheduled Task


Recommended Posts

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

Link to comment
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.


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

Link to comment
Share on other sites

  • Developers

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.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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

Link to comment
Share on other sites

  • Developers

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.

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
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 :)

Link to comment
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...

Link to comment
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.

Link to comment
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?

Link to comment
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.

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...