Sign in to follow this  
Followers 0
Testy

Timeout for program error.

4 posts in this topic

Script gets stuck waiting for a window. If the program encounters an error and the needed window doesn't show, it will get stuck waiting.

Func login()
    WinWaitActive("Sign On")
    Sleep(1000)
    Send("user{TAB}")
    Send("password{ENTER}")
    timeout() 
 EndFunc
 
Func timeout()
    (, 0, 3000)
EndFunc

Won't timeout.

Share this post


Link to post
Share on other sites



Script gets stuck waiting for a window. If the program encounters an error and the needed window doesn't show, it will get stuck waiting.

Func login()
    WinWaitActive("Sign On")
    Sleep(1000)
    Send("user{TAB}")
    Send("password{ENTER}")
    timeout() 
 EndFunc
 
Func timeout()
    (, 0, 3000)
EndFunc

Won't timeout.

Use WinWaitActive with a timeout parameter. If the return is 0 then do something - see the help.


Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

Use WinWaitActive with a timeout parameter. If the return is 0 then do something - see the help.

Ha ha... Check it

Func login()
    WinWaitActive("Sign On", "", 10)
    Sleep(1000)
    Send("user{TAB}")
    Send("password{ENTER}")
EndFunc

Read the helpfile, and got an interesting result.  While the timer works, it will however pop to the next button on the tab and runs it.  WTF?


            
        

        
            
                

    
        
            
        
    


            
        

        
            
                
                
                
            
            
                
            
        
        
    

    
        
            Share this post
            
Link to post
            
            
            

            
                Share on other sites
                

    
        
            

    

        
            

    

        
            

    

        
            

    

        
    

            
        
    


    

                    
                
                    
                    
                    






    
    
        
martin   

    
        
    
             66
    
        
    

        
            
                ~~\o/~~~/0\=¬''~~~
            
            

            
                

    
        
    

            
            MVPs
            
                
            
            
                

    
        
    
             66
    
        
    

                7,141 posts
                
                

            
        
    
    
        


    

    
        
            
            
                
            
            
        

        
    #4 · 
            Posted 
            
                (edited)
            
            
            
        
    

    


            
        
            Ha ha... Check it

Func login()
    WinWaitActive("Sign On", "", 10)
    Sleep(1000)
    Send("user{TAB}")
    Send("password{ENTER}")
EndFunc

Read the helpfile, and got an interesting result. While the timer works, it will however pop to the next button on the tab and runs it. WTF?

You didn't pay full attention to my post. You have to check to see what WinWaitActive returns. If it returns 0 it means it timed out so you have to take some appropriate action. Without checking it will continue with the next line whatever the result.

Func login()
    if WinWaitActive("Sign On", "", 10) = 0 then
          MsgBox(0,'failed', '"Sign On" window did not appear before I got bored')
          return -1;failed
        endif
    Sleep(1000)
    Send("user{TAB}")
    Send("password{ENTER}")
EndFunc
Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

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