MattHiggs Posted February 8, 2016 Share Posted February 8, 2016 Ok, so I have a function that I wrote which contains the following Spoiler Func names($hodd) #Region --- CodeWizard generated code Start --- ;InputBox features: Title=Yes, Prompt=Yes, Default Text=No, Mandatory If Not IsDeclared("sInputBoxAnswer") Then Local $sInputBoxAnswer $sInputBoxAnswer = InputBox("Name", "Please enter your first and last name.") $Namearray = StringSplit($sInputBoxAnswer, " ") Select Case @error = 0 And $Namearray[0] = 2 And $Namearray[2] <> "" IniWrite($path & "\login.ini", "Name", "First", $Namearray[1]) IniWrite($path & "\login.ini", "Name", "Last", $Namearray[2]) Case @error = 1 ;The Cancel button was pushed #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=None MsgBox(0,"1","1") #EndRegion --- CodeWizard generated code End --- Case @error = 3 ;The InputBox failed to open #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=None MsgBox(0,"2","2") #EndRegion --- CodeWizard generated code End --- Case Else #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=None MsgBox(0,"3","3") #EndRegion --- CodeWizard generated code End --- #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Critical MsgBox($MB_OK + $MB_ICONHAND,"an error occured","Did you put input your full name separated by space?") #EndRegion --- CodeWizard generated code End --- names (True) EndSelect #EndRegion --- CodeWizard generated code Start --- If $hodd = False Then #Region --- CodeWizard generated code Start --- ;MsgBox features: Title=Yes, Text=Yes, Buttons=OK, Icon=Info MsgBox($MB_OK + $MB_ICONASTERISK, "Restart", "You must close then relaunch this program in order for the additions/changes you have made to display.") #EndRegion --- CodeWizard generated code Start --- EndIf EndFunc ;==>names The message boxes for when @error is not equal to 0 were placed there to help me try and understand why my function wasn't behaving as expected. It is meant to take a persons full name (implying a space) from the input box and, given that criteria is met, store it in a .ini file. Now I put the criteria which need to be met as part of the Case @error = 0, as it defines what makes the input truly valid for my purposes, and used "case else" to provide action to take when @error still = 0, but does not conform to the first name last name schema (Which would display an error message). However, when I run the above code, a get a message box with number 1, indicating that @error is being set to 1 as if I just hit the cancel button. Am I doing something wrong, or is this a bug? Link to comment Share on other sites More sharing options...
Danyfirex Posted February 8, 2016 Share Posted February 8, 2016 stringsplit If no delimiters were found then the @error flag is set to 1: Saludos Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut Link to comment Share on other sites More sharing options...
MattHiggs Posted February 8, 2016 Author Share Posted February 8, 2016 Wow. derp moment. Thanks Link to comment Share on other sites More sharing options...
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