PcExpert Posted June 2, 2006 Share Posted June 2, 2006 Hello, Is is possible to match the input given in a inputbox? For example: The answere is red, because thats a colour, but the user types only red, then it checks if the word matches with somewhere in the answere, if the word matches it displays a msgbox. Link to comment Share on other sites More sharing options...
Paulie Posted June 2, 2006 Share Posted June 2, 2006 Hello, Is is possible to match the input given in a inputbox? For example: The answere is red, because thats a colour, but the user types only red, then it checks if the word matches with somewhere in the answere, if the word matches it displays a msgbox.How about: Dim $pass = "Bob" do $passwd = Inputbox("Password", "Input Password Here") If $passwd = $pass then Msgbox(0,"Correct", "Access Granted") Else Msgbox(0, "Sorry", "WRONG!!") Endif Until $passwd = $pass I hope that answers you Question Sorry if i misunderstood Link to comment Share on other sites More sharing options...
PcExpert Posted June 2, 2006 Author Share Posted June 2, 2006 That's a good way, but what I exsually meant is: Is it possible to match the input given in the inputbox with a programmed text. So if the answere is: "red, because thats a colour" and the user types only "red" than the access is also granted. If no word matched the access is denied Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 2, 2006 Moderators Share Posted June 2, 2006 That's a good way, but what I exsually meant is: Is it possible to match the input given in the inputbox with a programmed text. So if the answere is: "red, because thats a colour" and the user types only "red" than the access is also granted. If no word matched the access is deniedWhy don't you show what you've done thus far to try attempt it.What is the scenerio that it would be Red as an answer, what situations would the user have to type that. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
Paulie Posted June 2, 2006 Share Posted June 2, 2006 (edited) That's a good way, but what I exsually meant is: Is it possible to match the input given in the inputbox with a programmed text. So if the answere is: "red, because thats a colour" and the user types only "red" than the access is also granted. If no word matched the access is denied Oh! Ok i see, Well, then modify the code like this maybe Change Dim $pass ="bob" to Dim $pass = "Bob is your brother" Then in the do until loop If StringInStr($passwd, $pass) Then Edit:Sorry Smoke, didn't know you wanted to make him do it himself :"> Edited June 2, 2006 by Paulie Link to comment Share on other sites More sharing options...
PcExpert Posted June 5, 2006 Author Share Posted June 5, 2006 It doesn't work Link to comment Share on other sites More sharing options...
Xenobiologist Posted June 5, 2006 Share Posted June 5, 2006 HI, I think this should work, but I would improve it to check for minimum 3 letters. Dim $pass = "Bob is your brother" $passwd = Inputbox("Password", "Input Password Here") If StringInStr($pass, $passwd) <> 0 Then Msgbox(0,"Correct", "Access Granted") Else Msgbox(0, "Sorry", "WRONG!!") Endif So long, Mega Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times Link to comment Share on other sites More sharing options...
PcExpert Posted June 5, 2006 Author Share Posted June 5, 2006 OK, thanks! It's a step in the good way. But if I now run it, it only checks for one word that matches. How to extend it? Once again, Thanks PcExpert Link to comment Share on other sites More sharing options...
Xenobiologist Posted June 5, 2006 Share Posted June 5, 2006 (edited) Hi, now I got what you wanted to achieve. Try this. Dim $pass = "The answer is red" Do Global $passwd = InputBox("Password", "Input Password Here") Until $passwd <> " " And StringLen($passwd) >= 3 MsgBox(64, "First check()", check()) Func check() Local $found = False Local $passwodArray = StringSplit($passwd, " ") For $i = 1 To UBound($passwodArray) - 1 If StringInStr($pass, $passwodArray[$i]) <> 0 Then $found = True ExitLoop EndIf Next If $found = True Then Return "Correct Access Granted" Else Return "Sorry WRONG!" EndIf EndFunc ;==>check So long, Mega Edited June 5, 2006 by th.meger Scripts & functions Organize Includes Let Scite organize the include files Yahtzee The game "Yahtzee" (Kniffel, DiceLion) LoginWrapper Secure scripts by adding a query (authentication) _RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...) Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc. MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times 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