Thornhunt Posted December 1, 2011 Posted December 1, 2011 (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 December 1, 2011 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
water Posted December 1, 2011 Posted December 1, 2011 (edited) If the variable $NewuserNameVar contains a string the comparison $NewuserNameVar = 0always 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 December 1, 2011 by water My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Thornhunt Posted December 1, 2011 Author Posted December 1, 2011 (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 December 1, 2011 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
water Posted December 1, 2011 Posted December 1, 2011 Glad to be of service My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now