chad.stout Posted November 21, 2006 Share Posted November 21, 2006 Hey, just wondering if there is a way to call a specified function on the event of a script haulting due to an error in the code (e.g. a function that dumps all current data into a log file). Thanks, -Chad Link to comment Share on other sites More sharing options...
lod3n Posted November 21, 2006 Share Posted November 21, 2006 Search the Forum for "RunErrorsFatal" and "AutoIt.Error" if you are using COM. There is no automatic way to dump the values of your variables into a file, you'd really have to do that manually as you go. Also search for "assert", some people have made some nifty assertion functions which could be adapted to that purpose. The best thing you can do is develop with Scite, and pump messages into it's console. Also, don't make assumptions about the state of your variables. For instance, if you run a function that is supposed to return an array of a specific size, before you go any further, test it by running it through IsArray, and make sure it's Ubound is what you expect. It takes longer, but it makes your code much more bulletproof. [font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font] Link to comment Share on other sites More sharing options...
chad.stout Posted November 21, 2006 Author Share Posted November 21, 2006 Search the Forum for "RunErrorsFatal" and "AutoIt.Error" if you are using COM.There is no automatic way to dump the values of your variables into a file, you'd really have to do that manually as you go. Also search for "assert", some people have made some nifty assertion functions which could be adapted to that purpose.The best thing you can do is develop with Scite, and pump messages into it's console.Also, don't make assumptions about the state of your variables. For instance, if you run a function that is supposed to return an array of a specific size, before you go any further, test it by running it through IsArray, and make sure it's Ubound is what you expect. It takes longer, but it makes your code much more bulletproof.Heh thanks for that!I do take many precautions to ensure the script runs properly, but it's already at 8K lines, and only about 2/3 done :/ Coupled with fat fingers, the script tends to break every so often.Thanks again,-Chad Link to comment Share on other sites More sharing options...
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