Ahile07 Posted September 21, 2016 Posted September 21, 2016 Hello guys. Again a dummy question for smart people. I'm wondering if any of you can help me with an issue. I've got a list of names that i would like to store into an array variable. Example $names = [name1][name2][name3] Then i've got an inputbox that asks for your name. I don't know how i can be able to see if the inputbox value is different then the names. I've done already separate if statements if the values are = with the names. But i want to check for error in case the value of the inputbox is different then my list of names. Hope it makes sense. Thank you
l3ill Posted September 21, 2016 Posted September 21, 2016 (edited) #include <Array.au3> Local $names[3] = ["name 1", "name 2", "name 3"] $sValue = InputBox("", "") If _ArraySearch($names, $sValue) Then MsgBox(0, "", "Wrong Name ! ") Else MsgBox(0, "", "$sValue = " & $sValue) EndIf Never mind, this didn't work as expected... Edited September 21, 2016 by l3ill My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
l3ill Posted September 21, 2016 Posted September 21, 2016 here we go...this one works: #include <Array.au3> Local $names[3] = ["name 1", "name 2", "name 3"] $sValue = InputBox("", "") If _ArraySearch($names, $sValue) = -1 Then MsgBox(0, "", "Wrong Name ! ") Else MsgBox(0, "", "$sValue = " & $sValue) EndIf Ahile07 1 My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
Moderators JLogan3o13 Posted September 21, 2016 Moderators Posted September 21, 2016 @Ahile07 did you not notice this at the top of the forum you posted this topic in? Quote Do not create AutoIt-related topics here, use the AutoIt General Help and Support Topic moved; please pay attention to where you post in the future. "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum!
l3ill Posted September 21, 2016 Posted September 21, 2016 Glad to help ! My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example
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