Xieciunio Posted June 2, 2009 Share Posted June 2, 2009 Hi, I want to design way for reacting for returns from different functions without putting any kind of "if" statement after every line. I wish to find way to be able to write many scripts quickly without thinking about lots securing functions. I was hoping to use adlib to check for changes in variables and if I will notice that @error or $return (witch is getting return value from every function) will have value other than 0 I will be able to report it and stop script. Problem is that between this checks there will be probably more than one function executed, so I am looking for any trace to function that was last to set this value. Link to comment Share on other sites More sharing options...
martin Posted June 2, 2009 Share Posted June 2, 2009 Hi,I want to design way for reacting for returns from different functions without putting any kind of "if" statement after every line. I wish to find way to be able to write many scripts quickly without thinking about lots securing functions. I was hoping to use adlib to check for changes in variables and if I will notice that @error or $return (witch is getting return value from every function) will have value other than 0 I will be able to report it and stop script. Problem is that between this checks there will be probably more than one function executed, so I am looking for any trace to function that was last to set this value.I regret that there is no method in sight which allows you to succesfully write scripts without thinking 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. Link to comment Share on other sites More sharing options...
Valuater Posted June 2, 2009 Share Posted June 2, 2009 (edited) I regret that there is no method in sight which allows you to succesfully write scripts without thinking Thats true... lol***********************************************so I am looking for any trace to function that was last to set this value.Maybe...._WinAPI_GetLastError()... and_WinAPI_GetLastErrorMessage()8) Edited June 2, 2009 by Valuater Link to comment Share on other sites More sharing options...
Valik Posted June 2, 2009 Share Posted June 2, 2009 Hi,I want to design way for reacting for returns from different functions without putting any kind of "if" statement after every line. I wish to find way to be able to write many scripts quickly without thinking about lots securing functions. I was hoping to use adlib to check for changes in variables and if I will notice that @error or $return (witch is getting return value from every function) will have value other than 0 I will be able to report it and stop script. Problem is that between this checks there will be probably more than one function executed, so I am looking for any trace to function that was last to set this value.This is the stupidest idea I've read in a long time. Link to comment Share on other sites More sharing options...
lordicast Posted June 2, 2009 Share Posted June 2, 2009 That made my brain hurt [Cheeky]Comment[/Cheeky] Link to comment Share on other sites More sharing options...
Valik Posted June 2, 2009 Share Posted June 2, 2009 Thats true... lol***********************************************so I am looking for any trace to function that was last to set this value.Maybe...._WinAPI_GetLastError()... and_WinAPI_GetLastErrorMessage()8)I should point out, these functions have nothing to do with @error. These functions should not be used to see what happened with built-in functions because there's no guarantee the last error actually has anything to do with what you think it does. Unlike AutoIt, Windows API functions do not reset the error value to 0 when they are called and some/many/most do not set error to 0 on success so that GetLastError() values can bleed through unrelated calls. About the only time GetLastError() is useful is after using DllCall(). Link to comment Share on other sites More sharing options...
Xieciunio Posted June 3, 2009 Author Share Posted June 3, 2009 For authors of serious answers: Thank You. For others: I am not asking for Your opinions about my project, I think that making things easier is something good. If You disagree, it is Your problem. Just think about role of debuggers and UDFs. For me this topic is ended. Link to comment Share on other sites More sharing options...
Valik Posted June 3, 2009 Share Posted June 3, 2009 For others: I am not asking for Your opinions about my project,That's really too bad then because the idea is idiotic. If you can't own up to that or refuse to listen to the wisdom of two MVPs and a developer, well, that's your problem.I think that making things easier is something good. If You disagree, it is Your problem.No, it's really your problem. You see, what makes a program good isn't how it behaves under normal circumstances but rather how it behaves under abnormal circumstances, id est your error checking code. If you wish to short-circuit the error checking code into some generalized morass, then the program is going to suck. Full stop. That's like having a single exception handler catch every single exception in a language like C++ or Python. Sure, it's probably a good idea to have a last resort exception handler but there should also be more granular handlers as well. The same holds true for a language like AutoIt with it's own error mechanism. For example, the way you would handle a file not existing might be to create the file. The way you would handle a call to Run() failing might be to abort. Errors are not created equally; some you can gracefully handle and continue execution of the program and others require immediate user-input or termination.But what do I know.Just think about role of debuggers and UDFs.You're comparing apples to cars to, uh, pencils. 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