Sign in to follow this  
Followers 0
Thornhunt

If or then else problem [SOLVED]

4 posts in this topic

#1 ·  Posted (edited)

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



#2 ·  Posted (edited)

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 (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

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

Glad to be of service :D


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

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  
Followers 0