DSIS Posted June 17, 2008 Posted June 17, 2008 I am using an AutoIT script to login to my Enterprise software and run a program that runs anywhere from 1 to 1 1/2 hours. When the program is finished it asks a question. if the user desires to view a log file? I use the WinWaitActive at this point to wait for the window that asks the question. The next statment tabs to the no answer. I kick this off on a server using the Windows task scheduler. The problem is that the script frequently hangs at this point(WinWaitActive("Question")) which requires manual intervention to at least answer the question. Am I not incroporating the WinWaitActive properly? Is there another function I should be using? Thanks. Code Example: WinWaitActive("Process MRP") send("{RIGHT}{TAB 3}") sleep(1000) send("MRPLog" & $logfiledate) sleep(2500) send("{TAB}{ENTER}") WinWaitActive("Question") send("{TAB}{ENTER}") WinWaitActive("Information") send("{ENTER}") sleep(1000) Send ("!{F4}") WinWaitActive("Vantage") Send("{TAB}{ENTER}")
cartman380 Posted June 17, 2008 Posted June 17, 2008 Have you tried putting a WinWait("Question") before you put the WinWaitActive. Perhaps the window comes up but is never activated? It's something to try at least.
TerarinKerowyn Posted June 17, 2008 Posted June 17, 2008 You should check to make sure WinActive is not activate then WinActivate it. Then you can WinWaitActive or WinWait Contact via MSN: [email=terarink_msn@hotmail.com]terarink_msn@hotmail.com[/email], yahoo: terarink_yah
cartman380 Posted June 17, 2008 Posted June 17, 2008 You should check to make sure WinActive is not activate then WinActivate it. Then you can WinWaitActive or WinWaitThat's what I meant to say
DSIS Posted June 18, 2008 Author Posted June 18, 2008 You should check to make sure WinActive is not activate then WinActivate it. Then you can WinWaitActive or WinWaitYou are suggesting that I insert something like the following prior to the WinWaitActive("Question")? If WinActive("Question") = 0 Then WinActivate("Question") EndIf
MHz Posted June 18, 2008 Posted June 18, 2008 A simple UDF function to handle the activation of the windows and then put underscores in front of the WinWaitActive functions and it may perform better. _WinWaitActive("Process MRP") send("{RIGHT}{TAB 3}") sleep(1000) send("MRPLog" & $logfiledate) sleep(2500) send("{TAB}{ENTER}") _WinWaitActive("Question") send("{TAB}{ENTER}") _WinWaitActive("Information") send("{ENTER}") sleep(1000) Send ("!{F4}") _WinWaitActive("Vantage") Send("{TAB}{ENTER}") Func _WinWaitActive($title, $text = "") ; wait for window, activate it and ; then wait until it is active WinWait($title, $text) WinActivate($title, $text) WinWaitActive($title, $text) EndFunc
cartman380 Posted June 18, 2008 Posted June 18, 2008 A simple UDF function to handle the activation of the windows and then put underscores in front of the WinWaitActive functions and it may perform better.CODE SAMPLE REMOVEDThat's exactly what I do in my scripts that use WinWaitActive guess I should have suggested that.
DSIS Posted June 19, 2008 Author Posted June 19, 2008 A simple UDF function to handle the activation of the windows and then put underscores in front of the WinWaitActive functions and it may perform better. _WinWaitActive("Process MRP") send("{RIGHT}{TAB 3}") sleep(1000) send("MRPLog" & $logfiledate) sleep(2500) send("{TAB}{ENTER}") _WinWaitActive("Question") send("{TAB}{ENTER}") _WinWaitActive("Information") send("{ENTER}") sleep(1000) Send ("!{F4}") _WinWaitActive("Vantage") Send("{TAB}{ENTER}") Thanks much. This seems to work. Func _WinWaitActive($title, $text = "") ; wait for window, activate it and ; then wait until it is active WinWait($title, $text) WinActivate($title, $text) WinWaitActive($title, $text) EndFunc
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now