erebus Posted November 11, 2004 Share Posted November 11, 2004 I use the following code: $no=1 Select Case Not IsNumber($no) MsgBox(0, "DEBUG", "$no is not a number") Exit EndSelect This works as expected. $no IS a number. Now I alter the above code as: $no = IniRead($ini, "Something", "Number", "NOTEXIST") Select Case Not IsNumber($no) MsgBox(0, "DEBUG", "$no is not a number") MsgBox(0, "DEBUG", $no + 1) Exit EndSelect "Number" in $ini = 1. Now AutoIT does not recognize $no as a number, executes the first MsgBox to indicate the error, however the result of the second MsgBox is "2". Can you explain this? If I'm doing something really stupid (headache rules) shoot me freely. Link to comment Share on other sites More sharing options...
Mr.Wizard Posted November 11, 2004 Share Posted November 11, 2004 And why are you using a Select when there's only one condition? Why not use an If? I have a catapult. Give me all the money or I will fling an enormous rock at your head. Link to comment Share on other sites More sharing options...
erebus Posted November 11, 2004 Author Share Posted November 11, 2004 (edited) @Larry: Why can't I find this function? (using the latest unstable) @Mr.Wizard: Just posted a sort example, there are more conditions in my case (that's why the Select function was used). Edit: Solved - used: $no = IniRead($ini, "Something", "Number", "NOTEXIST") Select Case Not Number($no) Thanks anyway guys Edited November 11, 2004 by erebus Link to comment Share on other sites More sharing options...
SlimShady Posted November 11, 2004 Share Posted November 11, 2004 I suggest you use StringIsDigit$no = IniRead($ini, "Something", "Number", "NOTEXIST") Select Case StringIsDigit($no) MsgBox(0, "DEBUG", "$no is not a number") MsgBox(0, "DEBUG", $no + 1) Exit EndSelect Link to comment Share on other sites More sharing options...
Developers Jos Posted November 11, 2004 Developers Share Posted November 11, 2004 @Larry: Why can't I find this function? (using the latest unstable)@Mr.Wizard: Just posted a sort example, there are more conditions in my case (that's why the Select function was used).Edit: Solved - used:$no = IniRead($ini, "Something", "Number", "NOTEXIST") Select Case Not Number($no)Thanks anyway guys <{POST_SNAPBACK}>Try this and see if that explains it:$no = 1 if Not IsNumber($no) then MsgBox(0, "DEBUG 1 ", "$no is not a number") $no = "1" if Not IsNumber($no) then MsgBox(0, "DEBUG 2", "$no is not a number") SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
erebus Posted November 11, 2004 Author Share Posted November 11, 2004 (edited) @JdeB: Thank you, I also got the same answer from Larry:IniRead returns a string...@SlimShady: Very good idea! Already updated, thank you. I think that is what Larry means. Edited November 11, 2004 by erebus 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