Jump to content

Recommended Posts

Posted

The help for True and False says: "These keywords should not be used in expressions as AutoIt will not detect this 'misuse' and the results will be unpredictable". What precisely is meant by this?

The example is:

$bool= False

if NOT $bool = true Then Msgbox(0,"Bool comparison", "OK")

Isn't $bool = true an expression?

Or is the help saying that

CODE
if FileCopy("C:\old\*.*", "C:\new\") = True then
won't work because FileCopy() returns 1 or 0?

...chris

Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

Posted

It's referring to context where it doesn't make sense. AutoIt won't reprimand you in those cases. For example:

$a = 1 + True
Posted

c.haslam

Works fine for me:

if FileCopy("c:\Help.htm", "D:\", 1) = True then MsgBox(0, "", "True")

Check path`s existing.

Keep in mind, explicitly testing booleans against a literal True or False is stupid. It does not need done and just clutters the code with needless crap.
Posted

My quibble is with the help file. Perhaps the wording could be improved. Is True equal to 1 and False to 0? Are "If 1 then ..." and "If True then" equivalent?

...chris

Spoiler

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard

 

  • Moderators
Posted

My quibble is with the help file. Perhaps the wording could be improved. Is True equal to 1 and False to 0? Are "If 1 then ..." and "If True then" equivalent?

...chris

Zero being the only "False" statement, as less than or greater than zero will be considered a "True" statement.

So when using a boolean statement, you need nothing more than If ($bool) Then or If (Not $bool) Then... Need not concern yourself with actual integer values.

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...