Search the Community
Showing results for tags 'if else statement'.
-
Hello, The @OSArch Macro references 3 types of Architecture: "X86", "IA64", "X64" Since there are 3 OS architecture types I best believe that the following else if Conditional Statement Syntax best deals with making the proper ultimate distinction between the three: Sntax: if (condition1) { block of code to be executed if condition1 is true } else if (condition2) { block of code to be executed if the condition1 is false and condition2 is true } else { block of code to be executed if the condition1 is false and condition2 is false } While being lately engaged in trying to reference each OS Architecture individually for a coding I was working on I had come across an old post with what I strongly believe to be insufficient reply by its Moderator. One of the new forum members had wanted to reference a 32 bit OS architecture individually and was given incomplete coding. I therefore believe this new forum member was right in being so very unsatisfied from the answer he was provided. This is the answer with Insufficient Coding Distinction in the Else Statement: ------------------------------------------------------------------------------------------------------ The following: Else Statement does not distinctly reference a 32 bit, as it could also reference an IA64 bit: If @OSArch = "X64" Then ;Do Something for 64bit machines Else ;Do Something for 32bit machines ; Insufficient Else detection code as could also reference "IA64" bit (Hillary) This above example was provided by: MODERATOR: JLogan3o13 So for the benefit of the distinguished AutoIt Forum members, here is the following Architecture Referencing code I have written for EACH OS INDIVIDUALLY which singles out and properly identifies the requested 32 bit OS as it should be in the Else Statement ----------------------------------------------------------------------------------------------------------------------------------------- #include <MsgBoxConstants.au3> If @OSArch = "X64" Then ;Do Something for 64 bit machines MsgBox($MB_SYSTEMMODAL, "condition1 is true", "64 bit version Detected !", 10) ElseIf @OSArch = "IA64" Then ;Do Something for IA64 bit machines MsgBox($MB_SYSTEMMODAL, "condition1 is false and condition2 is true", "IA64 bit version Detected !", 10) Else ;Do Something for 32 bit machines MsgBox($MB_SYSTEMMODAL, "condition1 is false and condition2 is false", "32 bit version Detected !", 10) EndIf Dear Forum Members if any of you have any other suggestions please feel completely free to present them on this post. bye, Hillary.