Jump to content

bug in autoit --Boolean values for use in logical expressions.


aria
 Share

Recommended Posts

I dont know if this is open or resolved in a beta. I am using the latest stable version on windows 2000 professional edition.

Basically using "false" (with the quotes) as a return type from a logical expression does not work, while "true" works.

Please note that both true/false without the quotes work fine.

All 4 cases are present below :-)

This works ---

$x = 1
$y = -2

Switch ($x == $y)
    Case    True
        MsgBox(0,"","true")
    Case    False
        MsgBox(0,"","false")
EndSwitch

----------------------

This works ---

$x = 1
$y = -2

Switch ($x <> $y)
    Case    True
        MsgBox(0,"","true")
    Case    False
        MsgBox(0,"","false")
EndSwitch

----------------------

this works only for "true",

$x = 1
$y = -2

Switch ($x <> $y)
    Case    "True"
        MsgBox(0,"","true")
    Case    "False"
        MsgBox(0,"","false")
EndSwitch

--------------

it does not work for "false" ---

$x = 1
$y = -2

Switch ($x == $y)
    Case    "True"
        MsgBox(0,"","true")
    Case     "False"
        MsgBox(0,"","false")
EndSwitch
Edited by aria
Link to comment
Share on other sites

I dont know if this is open or resolved in a beta. I am using the latest stable version on windows 2000 professional edition.

Basically using "false" (with the quotes) as a return type from a logical expression does not work, while "true" works.

Please note that both true/false without the quotes work fine.

All 4 cases are present below :-)

This works ---

$x = 1
$y = -2

Switch ($x == $y)
    Case    True
        MsgBox(0,"","true")
    Case    False
        MsgBox(0,"","false")
EndSwitch

----------------------

This works ---

$x = 1
$y = -2

Switch ($x <> $y)
    Case    True
        MsgBox(0,"","true")
    Case    False
        MsgBox(0,"","false")
EndSwitch

----------------------

this works only for "true",

$x = 1
$y = -2

Switch ($x <> $y)
    Case    "True"
        MsgBox(0,"","true")
    Case    "False"
        MsgBox(0,"","false")
EndSwitch

--------------

it does not work for "false" ---

$x = 1
$y = -2

Switch ($x == $y)
    Case    "True"
        MsgBox(0,"","true")
    Case     "False"
        MsgBox(0,"","false")
EndSwitch

They all work if you check for a boolean result instead of a string. "False" is a string, False is a boolean value.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Yes, i'm pretty sure the reason it's returning true for "True" and "False" is because they are non-null strings, and anything that's <> 0 = true. Just use True and False without the strings. Or you can use 0 and 1.

~cdkid

AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...