dem3tre Posted January 3, 2007 Posted January 3, 2007 I must be missing something fundamental to how AutoIt works as I cannot see why the following code does not work:#include <array.au3> Global Const $__DP_Version[4] = [ '0.10', 1, 10, '2007/01/03' ] Global Enum _; indexes into __DP_Version array $__DP_VersionString = 0, _ $__DP_VersionMajor, _ $__DP_VersionMinor, _ $__DP_VersionDate _ArrayDisplay( $__DP_Version, "__DP_Version" ) ;;; Both of the following tests should generate message boxes, but neither do If $__DP_Version[ $__DP_VersionMajor ] <> 3 Then MsgBox ( 0 , "Major", "not 3" ) If $__DP_Version[ $__DP_VersionMinor ] <> 15 Then MsgBox ( 0 , "Minor", "not 15" )Okay, what really makes this fustrating is that the above code works sometimes meaning I may get the first message box but not the second, or maybe I'll get the second message box but not the first, but most often I get neither. Thinking it was a problem with my development environment I shut everything down, cleaned out the temp folders, rebooted, etc and nope - still have the same problem with inconsistent results, so either I found a bug in AutoIt or I'm missing something in the snippet above.Compiling against AutoIt 3.2.2.0 and AutoItSciTE4 dated 12/31/2006.This is driving me bonkers Thanks ~
Josbe Posted January 3, 2007 Posted January 3, 2007 Testing...10+ times, same results:Array displayed...Msgbox: "not 3"...Msgbox: "not 15"... AUTOIT > AutoIt docs / Beta folder - AutoIt latest beta
Fossil Rock Posted January 3, 2007 Posted January 3, 2007 I get 3 message boxes. Agreement is not necessary - thinking for one's self is!
dem3tre Posted January 4, 2007 Author Posted January 4, 2007 Bummer. Even on my home machine its flaky. I thought maybe it could be the mixing of intristic types in the array so I changed: Global $__DP_Version[4] = [ '0.10', 5, 10, '2007/01/03' ]oÝ÷ Ù:ºÚ"µÍÛØ[ ÌÍ××ÑÕÚ[ÛÍHHÈ ÌÎNÌL ÌÎNË ÌÎNÍIÌÎNË ÌÎNÌL ÌÎNË ÌÎNÌ ËÌKÌÉÌÎNÈ but that didn't result in any changes for me. How weird.
Uten Posted January 4, 2007 Posted January 4, 2007 What happens if you rewrite your code slightly? #include <array.au3> Global Const $__DP_Version[4] = [ '0.10', 1, 10, '2007/01/03' ] Global Enum _; indexes into __DP_Version array $__DP_VersionString = 0, _ $__DP_VersionMajor, _ $__DP_VersionMinor, _ $__DP_VersionDate ;_ArrayDisplay( $__DP_Version, "__DP_Version" ) ;;; Both of the following tests should generate message boxes, but neither do Local $i, $j, $k, $max = 100 For $i = 1 to $max If $__DP_Version[ $__DP_VersionMajor ] <> 3 Then $j += 1 ;ConsoleWrite("+++Major not 3" & @LF);MsgBox ( 0 , "Major", "not 3" ) If $__DP_Version[ $__DP_VersionMinor ] <> 15 Then $k += 1 ;ConsoleWrite("---Minor not 15" & @LF);MsgBox ( 0 , "Minor", "not 15" ) Next ; No flaky behavior on my machine..:) Assert($j=$max, "$j:=" & $j & " <> " & $max) Assert($k=$max, "$k:=" & $j & " <> " & $max) Exit Func Assert($bool, $msg="", $erl=@ScriptLineNumber) If not $bool Then ConsoleWrite("(" & $erl & ") := " & $msg & @LF) EndIf EndFunc Also note that you can sometimes get "flaky" behavior when you compare a string and a number (even if you think it's a number) But I don't think that is the case here. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling
dem3tre Posted January 4, 2007 Author Posted January 4, 2007 I added the additional logging and it failed in the same way. This morning I uninstalled all of the AutoIt and SciTE bits from my machine and manually went through to clear out its directories, temp folders, etc again and reinstalled. Now its working as expected and I cannot make it fail. Wish I knew what the problem was but am just glad its gone now and I can move on. Thanks everyone!
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