Jump to content
Sign in to follow this  
Thornhunt

If or then else problem [SOLVED]

Recommended Posts

Thornhunt

i have run into a problem in my script were it does not run the else block.

i have placed msgboxes to make sure the variable in the expression id different to the values in the statement but still it fails to run the else block.

it probially is a error in how i have written it but my eyes are not seeing it, could anyone see were i have gone wrong.

case $NewuserContinueBtn
     MsgBox(1,"",$NewuserNameVar)
     if $NewuserNameVar = 0 or $NewuserNameVar = "" Then
      MsgBox(1,"",$NewuserNameVar)
      MsgBox(48,"Oops","Please Give your character a name")
     Else
      $NewuserEmailVar = GUICtrlRead($NewuserEmailIpt)

the message box is checking what the variable is, and everytime (even after the 'then' its stiff different.) yet it still fails to run the else block instead it runs the "MsgBox(48,"Oops","Please Give your character a name")"

thanks in advance for anyhelp

Edited by Thornhunt

Budweiser + room = warm beerwarm beer + fridge = too long!warm beer + CO2 fire extinguisher = Perfect![quote]Protect the easly offended ... BAN EVERYTHING[/quote]^^ hmm works for me :D

Share this post


Link to post
Share on other sites
water

If the variable $NewuserNameVar contains a string the comparison

$NewuserNameVar = 0
always is true because AutoIt has to convert the string to a numeric value. So before you compare check the datatype using IsInt or something similar.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
Thornhunt

ahhh thakyou verymuch, at the start of my script the variable was declared as a integer however it is then changed to a string later in the script .. ahhh typical schoolboy error.. once again thankyou

/edit

wow i still cant belive how i clear it was.

Edited by Thornhunt

Budweiser + room = warm beerwarm beer + fridge = too long!warm beer + CO2 fire extinguisher = Perfect![quote]Protect the easly offended ... BAN EVERYTHING[/quote]^^ hmm works for me :D

Share this post


Link to post
Share on other sites
water

Glad to be of service :D


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
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
Sign in to follow this  

×