crzftx Posted October 3, 2007 Share Posted October 3, 2007 (edited) IniWrite(@ScriptDir&"\Scores.txt","X",5,15) $temp = IniRead(@ScriptDir&"\Scores.txt","X",4,10000) If IniRead(@ScriptDir&"\Scores.txt","X",5,10000) > $temp Then MsgBox(0,"WTF","look at the comparison"&@CRLF&"15 > 10000 ?") EndIf $temp = IniRead(@ScriptDir&"\Scores.txt","X",4,9999) If IniRead(@ScriptDir&"\Scores.txt","X",5,9999) > $temp Then MsgBox(0,"WTF","now look at the comparison"&@CRLF&"15 > 9999 ?") EndIf I am using BETA 3.2.9.1, and using XP Pro. but those shouldn't matter. Look at the two codes, nearly exactly the same, one is 10000 and the other 9999. 15 is less than both, but when in this format only registers as greater than 10000. what am I doing wrong? Edited August 9, 2017 by crzftx Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 3, 2007 Moderators Share Posted October 3, 2007 (edited) IniWrite(@ScriptDir&"\Scores.txt","X",5,15) $temp = IniRead(@ScriptDir&"\Scores.txt","X",4,10000) If IniRead(@ScriptDir&"\Scores.txt","X",5,10000) > $temp Then MsgBox(0,"WTF","look at the comparison"&@CRLF&"15 > 10000 ?") EndIf $temp = IniRead(@ScriptDir&"\Scores.txt","X",4,9999) If IniRead(@ScriptDir&"\Scores.txt","X",5,9999) > $temp Then MsgBox(0,"WTF","now look at the comparison"&@CRLF&"15 > 9999 ?") EndIf I am using BETA 3.2.9.1, and using XP Pro. but those shouldn't matter. Look at the two codes, nearly exactly the same, one is 10000 and the other 9999. 15 is less than both, but when in this format only registers as greater than 10000. what am I doing wrong?Has to be a bug? Let me see if I can explain this so you go IniRead basically equals: FileOpen FileRead String Manipulation Return Val FileClose Nothing in there shows you it would return an integer or a number. The return value is actually a string ... To do what you want: Number(IniRead(etc...)) or Int(IniRead(etc...)) will work. Edited October 3, 2007 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
crzftx Posted October 5, 2007 Author Share Posted October 5, 2007 (edited) removed Edited August 9, 2017 by crzftx Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 5, 2007 Moderators Share Posted October 5, 2007 Ahh, you are right. Why does IniRead(@ScriptDir&"\Scores.txt","X",4,10000) return "10000" instead of 10000?Why would it return anything other than a string? You are "reading" a string value... how can it decide that this "1234" should be a number and not a string? Easier and less error prone to just make them all strings wouldn't you think (and leave it up to the user to make that string a number if deemed neccessary)?And why is 15 > "10000" but less than "9999"?Strings have a numeric value... just not what is listed in that string.15 may be greater than "abcde" but may be less than "abcd". Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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