Elephant007 Posted October 14, 2012 Share Posted October 14, 2012 (edited) I am stuck on trying to figure this one out. I have search with no success Basically I have a GUICtrlCreateInput which I need to be read to make sure is has 4 digits in it before the script will continue $InputBox = GUICtrlCreateInput ('', 10, 10, 100, 20 ) GUICtrlSetLimit ($InputBox, 4, 4 ) $Accept = GUICtrlCreateRadio('Accept', 20, 20, 100, 20 ) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop Case $Accept If GUICtrlRead($Input) ????? Then.... The inputbox must contain 4 digits, it doesn't matter if the a letters or numbers (no special characters would be nice to prevent too) If someone could give me good direction on how I can check to ensure the box has 4 digits, I can do the rest... Thank you in advance for all your help Edited October 14, 2012 by Elephant007 Link to comment Share on other sites More sharing options...
somdcomputerguy Posted October 14, 2012 Share Posted October 14, 2012 Try the StringLen() function. - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Link to comment Share on other sites More sharing options...
stormbreaker Posted October 14, 2012 Share Posted October 14, 2012 (edited) If StringLen(GUICtrlRead($Input)) = 4 Then DoSomething()Perhaps...REASON FOR EDIT: Perhaps a bad practice to use quotes (as Smoke_N pointed out) Edited October 14, 2012 by MKISH ---------------------------------------- :bye: Hey there, was I helpful? ---------------------------------------- My Current OS: Win8 PRO (64-bit); Current AutoIt Version: v3.3.8.1 Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 14, 2012 Moderators Share Posted October 14, 2012 (edited) Geeze, your request is so confusing ( 4 digits ... then you say ... doesn't matter if it has regular characters or numbers ), last I checked, a digit was a number?- removed stringlen() suggestion comment because I re-read requestOr, just use regex if your request is really "At Least 4 Numbers":; at least 4digits and any other characters If StringRegExp(GUICtrlRead($Input), "d{4}") Then ; etc etc and so on Edited October 14, 2012 by SmOke_N 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...
Elephant007 Posted October 14, 2012 Author Share Posted October 14, 2012 I guess I should have been clearer I mean alpha-numeric... doesn't matter if it's 0-9 or A-Z or a combination of both, I used digit incorrectly, I apologize With the help that I received I was able to use this to solve my issue If StringLen(GUICtrlRead($Input)) < 4 Then MsgBox(0,'', 'Less Than 4') I appreciate everyone's speedy suggestions 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