vickerps Posted March 18, 2004 Share Posted March 18, 2004 Is there any wildcards set up in autoit For example I want a person to enter text into text box but it has to be in a set format eg. 10:20:30 third & sixth charactor must be a : but the rest could be any number Link to comment Share on other sites More sharing options...
scriptkitty Posted March 18, 2004 Share Posted March 18, 2004 Use a split string function. ; this format 10:20:30 while 1 $answer = InputBox("Question", "What time."&@crlf&"10:20:30 format please", "10:20:30", "", -1, -1, 0, 0) $answer1=Stringsplit($answer,":") if IsArray ($answer1) then if $answer1[0]=3 then exitloop wend msgbox(1,$answer,$answer1[1]&" "&$answer1[2]&" "&$answer1[3]) AutoIt3, the MACGYVER Pocket Knife for computers. Link to comment Share on other sites More sharing options...
vickerps Posted March 19, 2004 Author Share Posted March 19, 2004 (edited) Thanks Scriptkitty that work great I just spent 30 min trying to understand what you did. I think i understand now Your spliting the string by : and storing the results into a array. Then your using the last ":" to create the exit from the loop Is that right it is important that i understand because I need to learn Edited March 19, 2004 by vickerps Link to comment Share on other sites More sharing options...
scriptkitty Posted March 19, 2004 Share Posted March 19, 2004 You got it pretty much. Code explained. ; this format 10:20:30 while 1 ;this is an endless loop, the Exit loop command jumps out of it. $answer = InputBox("Question", "What time."&@crlf&"10:20:30 format please", "10:20:30", "", -1, -1, 0, 0) ; this asks the user for the proper input $answer1=Stringsplit($answer,":") ;This creates an array automatically delimited by the : and assigns the number of ; elements besides itself to $answer1[0] if IsArray ($answer1) then if $answer1[0]=3 then exitloop ; if it became an array, and then if the array has 4 elements (3 + $answer1[0]) it jumps out of the loop and continues past wend wend ; if no exitloop is found, it repeats again. msgbox(1,$answer,$answer1[1]&" "&$answer1[2]&" "&$answer1[3]) ; displays data for you, you could do anything you want from this point. AutoIt3, the MACGYVER Pocket Knife for computers. 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