tamir Posted February 15, 2005 Share Posted February 15, 2005 how can i prevent a user from entering specific characters such as ! ^ & into an input control? or maybe just allow the user to input letters (and maybe integers too) Link to comment Share on other sites More sharing options...
zcoacoaz Posted February 15, 2005 Share Posted February 15, 2005 i think there is a more proper way but my solution would be to check for those characters in the while loop and if they show up automaticly delete them and play the error noise. some one else probably has a better solution though [font="Times"] If anyone remembers me, I am back. Maybe to stay, maybe not.----------------------------------------------------------------------------------------------------------[/font][font="Times"]Things I am proud of: Pong! in AutoIt | SearchbarMy website: F.R.I.E.S.A little website that is trying to get started: http://thepiratelounge.net/ (not mine)[/font][font="Times"] ----------------------------------------------------------------------------------------------------------[/font][font="Arial"]The newbies need to stop stealing avatars!!! It is confusing!![/font] Link to comment Share on other sites More sharing options...
Blue_Drache Posted February 15, 2005 Share Posted February 15, 2005 (edited) i think there is a more proper way but my solution would be to check for those characters in the while loop and if they show up automaticly delete them and play the error noise. some one else probably has a better solution though<{POST_SNAPBACK}>I would do it this way, myself. Check for the existance of illegal characters with a StringSplit, For, StringIsXXX, Set Flag, Next loop.Dim $input, $inputarray, $flag = 0 Do $input = InputBox("Test","Put test text here") If @error = -1 then Exit $inputarray = $input StringSplit($inputarray,""); splits each element into an array. For $x = 1 to $inputarray[0] step 1 If StringIsAlpha($inputarray[$x]) = 0 or _ StringIsDigit($inputarray[$x]) = 0 then $flag = 1 Next If $flag = 1 then MsgBox(48,"Error","Illegal Characters Specified." & _ @LF & "Please use only letters and numbers.",5) Until $flag = 0 Edited February 15, 2005 by Blue_Drache Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache Link to comment Share on other sites More sharing options...
tamir Posted February 15, 2005 Author Share Posted February 15, 2005 hmm i think i've seen once a way to block the user from entering it... i'm looking for more elegant way :/ Link to comment Share on other sites More sharing options...
Andre Posted February 15, 2005 Share Posted February 15, 2005 Hi, Try using the _IsPressed function inside an AdLibEnable ? Andre What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel! 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