Xieciunio Posted May 23, 2009 Posted May 23, 2009 Hi, I am creating automation script for desktop application. Is there any way to change script reaction for situations when script is unable to find a control? Normal reaction of script is to pause. Is it possible to change this reaction for something like msgbox or executing other function? I know that I could check is control available, but doing this every time will take lots of time while scripting. Regards
Mat Posted May 23, 2009 Posted May 23, 2009 (edited) Have you tried: ObjEvent ("AutoIt.Error", "_onerror") ;;;;;;;;;;;;Script;;;;;;;;;;;;;;; Func _onerror () MsgBox (0, "", "Error!!") EndFunc ; ==> _onerror?? Or does that not do it? What functions are you using? You could make a timout... MDiesel Edited May 23, 2009 by mdiesel AutoIt Project Listing
PsaltyDS Posted May 23, 2009 Posted May 23, 2009 Hi,I am creating automation script for desktop application. Is there any way to change script reaction for situations when script is unable to find a control? Normal reaction of script is to pause. Is it possible to change this reaction for something like msgbox or executing other function? I know that I could check is control available, but doing this every time will take lots of time while scripting.RegardsPost code that reproduces your issue. AutoIt scripts DO NOT pause just because a control is not found, unless you coded it that way with a loop that has no error handling or something. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Xieciunio Posted May 23, 2009 Author Posted May 23, 2009 Post code that reproduces your issue. AutoIt scripts DO NOT pause just because a control is not found, unless you coded it that way with a loop that has no error handling or something.My mistake about pausing. I am talking about simple situations/functions like:1. Function Click with argument pointing to control that cannot be found2. New child window will appear and script will not be able to continue3. Application will close (this is where scritp will be "paused"(red "X" is flashing in tray) if I have any WaitWindow-like functions)I need to write scripts for application where this situations will appear and wish to be able to react automaticlyUnfortunetelly this situations are not treat like errors, and as far as I know error handling will not catch it.
PsaltyDS Posted May 26, 2009 Posted May 26, 2009 My mistake about pausing. I am talking about simple situations/functions like:1. Function Click with argument pointing to control that cannot be found2. New child window will appear and script will not be able to continue3. Application will close (this is where scritp will be "paused"(red "X" is flashing in tray) if I have any WaitWindow-like functions)I need to write scripts for application where this situations will appear and wish to be able to react automaticlyUnfortunetelly this situations are not treat like errors, and as far as I know error handling will not catch it.Still need to see a reproducer to show what the issue is. None of the situations you describe need to hang a properly coded script. Take them one at a time, if that helps. Post a short reproducer script to demo your "Function Click" issue. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
Xieciunio Posted May 28, 2009 Author Posted May 28, 2009 Sorry for no reply. I think that all that I needed was to spend more time with documentation. All this functions that I wish to monitor (click, winwait etc.) are returning 0 if there is something wrong. To resolve all my problem, I just need to monitor this returns witch is not hard to do. I do not have a clear solution for coding-less monitoring jet, but I think that I have compromised myself with this question enough Sorry for taking your time and thank You for fixing my way of thinking
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