dooshorama Posted January 14, 2005 Posted January 14, 2005 is @error set by commands that are not listed to use it in the help file? ..another words, does every command set @error when it is done? the reason i got suspicious was that i did a command like: [loop] $temp=stringstripws(filereadline($file),1) if @error = -1 then exitloop [endloop] but the loop never finished. even though the help file does not specify that "stringstripws" sets @error, it appears that it does. i'm not looking for help on the code, i've already taken care of it by breaking it down to seperate steps. main question still stands however.
MHz Posted January 14, 2005 Posted January 14, 2005 I have tried a number of variations, and keep coming up with 0 for error. Have you added a variable in your code, so you can store the error code, and simply use a messagebox, to show the result?
CyberSlug Posted January 14, 2005 Posted January 14, 2005 If the help file does not mention @error for a function, do not rely on its value. Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Valik Posted January 14, 2005 Posted January 14, 2005 You're all missing the obvious. The problem is, every function resets @error to 0. You have nested function calls, so StringStripWS resets @error back to 0, thus you never get to see if FileReadLine set @error.
SlimShady Posted January 14, 2005 Posted January 14, 2005 You're all missing the obvious. The problem is, every function resets @error to 0. You have nested function calls, so StringStripWS resets @error back to 0, thus you never get to see if FileReadLine set @error.<{POST_SNAPBACK}>True. stringstripws is the last function that's being called before it goes to the next line.
MHz Posted January 14, 2005 Posted January 14, 2005 You're all missing the obvious. The problem is, every function resets @error to 0. You have nested function calls, so StringStripWS resets @error back to 0, thus you never get to see if FileReadLine set @error.<{POST_SNAPBACK}>Nah, the obvious was, did StringStripWS cause it to exit the loop. Like StringStripWS have a bug in it. Or the help guide have a bug, always good to check.
Blue_Drache Posted January 14, 2005 Posted January 14, 2005 You're all missing the obvious. The problem is, every function resets @error to 0. You have nested function calls, so StringStripWS resets @error back to 0, thus you never get to see if FileReadLine set @error.<{POST_SNAPBACK}>So the obvious solution would be to step out the functions you need to check the value of @error to have its own line, right? Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache
dooshorama Posted January 14, 2005 Author Posted January 14, 2005 every function resets @error to 0.this was exactly my question, thanx valik.So the obvious solution would be to step out the functions you need to check the value of @error to have its own line, right?i've already taken care of it by breaking it down to seperate steps.PS> i'm not sure i like this behaviour. i think @error resets should be limited to the functions that actualy use it. i don't see the point in checking for @error if the function doesn't set it to 1. so why reset it to 0?if function_doesnt_use(@error) then dont_reset(@error)because, you don't see someone doing:function_that_doesnt_use_@error()if @error then ...no?
MHz Posted January 14, 2005 Posted January 14, 2005 Your script starts with @error = 0, so if you use this function, it will not upset @error = 0.
SlimShady Posted January 14, 2005 Posted January 14, 2005 Your script starts with @error = 0, so if you use this function, it will not upset @error = 0.<{POST_SNAPBACK}>Exactly. I don't understand how people can't understand this.
Administrators Jon Posted January 14, 2005 Administrators Posted January 14, 2005 this was exactly my question, thanx valik.PS> i'm not sure i like this behaviour. i think @error resets should be limited to the functions that actualy use it. i don't see the point in checking for @error if the function doesn't set it to 1. so why reset it to 0?if function_doesnt_use(@error) then dont_reset(@error)because, you don't see someone doing:function_that_doesnt_use_@error()if @error then ...no? If we only reset it for functions that used it then later on if we change some function that didn't use it to use it then imagine how many scripts would break because of assumptions... You can always store the value for later:$retval = somefunc()$err = @error Deployment Blog: https://www.autoitconsulting.com/site/blog/ SCCM SDK Programming: https://www.autoitconsulting.com/site/sccm-sdk/
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