nAutoIT Posted June 25, 2011 Share Posted June 25, 2011 If $ZahlenArray[3][1] = $ZahlenArray[4][1] = $ZahlenArray[2][2] = $ZahlenArray[3][2] = $ZahlenArray[4][2] = $ZahlenArray[3][3] = $ZahlenArray[4][3] = $ZahlenArray[3][4] = $ZahlenArray[4][4] = $ZahlenArray[3][5] = $ZahlenArray[4][5] = $ZahlenArray[3][6] = $ZahlenArray[4][6] = $ZahlenArray[2][7] = $ZahlenArray[3][7] = $ZahlenArray[4][7] = $ZahlenArray[5][7] = "1" And $ZahlenArray[1][1] = $ZahlenArray[2][1] = $ZahlenArray[5][1] = $ZahlenArray[4][2] = $ZahlenArray[3][2] = $ZahlenArray[4][3] = $ZahlenArray[3][3] = $ZahlenArray[4][3] = $ZahlenArray[3][4] = $ZahlenArray[4][4] = $ZahlenArray[3][4] = $ZahlenArray[4][5] = $ZahlenArray[3][5] = $ZahlenArray[4][5] = $ZahlenArray[3][6] = $ZahlenArray[4][6] = $ZahlenArray[3][6] = $ZahlenArray[4][7] = $ZahlenArray[3][7] = $ZahlenArray[4][7] = "0" Then MsgBox(1,"test","1") When the array is filled with "1"´s i get a msgbox, also if the array is filled with "0"´s i get a msgbox. I want the statement to be executed if the first bunch of array elements are "1" and the others are "0". Could somebody please explain to me, what im doing wrong there? Link to comment Share on other sites More sharing options...
jchd Posted June 25, 2011 Share Posted June 25, 2011 There is no such construct as chained comparison tests in AutoIt language. Hence, your statement evaluates like: If (((((((((($ZahlenArray[3][1] = $ZahlenArray[4][1]) = $ZahlenArray[2][2]) ... the first parenthesis results in a boolean, which you compare to a plain value, etc. Rewrite your test from scratch! Local $val = "1" ;; BTW, do you mean "1" or simply 1 ??? If $ZahlenArray[3][1] = $val And $ZahlenArray[4][1] = $val And $ZahlenArray[2][2] = $val And ... This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
nAutoIT Posted June 25, 2011 Author Share Posted June 25, 2011 I meant "1", but it would be no problem to change that to 1. Thanks for the quick and very good answer. If $string1 == $string2 Then ... does the same as: If ($string1 == $string2) = 1 Then ... Did i understand that right? Link to comment Share on other sites More sharing options...
jchd Posted June 25, 2011 Share Posted June 25, 2011 Lookup the help file at Language Reference >> Datatypes. Technically, (expr1 <comparison operator> expr2) gives a boolean result in {False, True}. Then that result can be converted to some other type. Conversion to integer yields the result you expect (True --> 1) but conversion to a string will probably disappoint you: True --> "True" and that string will convert to 0 in a comparison against an integer. That's why it's much safer to use the first form If $string1 == $string2 Then ... than the second one. Then don't forget that == means a case-sensitive, locale-insensitive, binary-wise comparison between strings. This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
nAutoIT Posted June 25, 2011 Author Share Posted June 25, 2011 (edited) If (int(string(1 = 1) = "True") = 1) Then ...Does not make any Sense and should be avoided, but the Expression is allways True.Did i get i now?p.s.: What does locale-insensitive mean? Is it about the scope in which they were created? Edited June 25, 2011 by nAutoIT Link to comment Share on other sites More sharing options...
jchd Posted June 25, 2011 Share Posted June 25, 2011 Correct but keep away from such constructs. No that means locale (regional) settings (string collation a.s.o.). This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe hereRegExp tutorial: enough to get startedPCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta. SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt) Link to comment Share on other sites More sharing options...
nAutoIT Posted June 25, 2011 Author Share Posted June 25, 2011 Thanks a lot. You were very helpful. 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