Sign in to follow this  
Followers 0
vickerps

Wildcards Charactors

4 posts in this topic

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

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

#3 ·  Posted (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 by vickerps

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0