Guest duomenox Posted April 5, 2005 Share Posted April 5, 2005 (edited) Hello everyone, I have a script that asks for user input. I am not using the GUI Controls as it would take a much longer time to write. I have a couple input boxes that I am asking the user to input 5 sets alpha numeric values of 5 digits each. I am then checking the strings to make sure they are 5 charactors and that all charactors are alpha numeric (no symbols). Here is my code: ;Declare and Set the $Variable[Array] Dim $Variable[5] For $Index = 0 to 4 Step 1 $Variable[$Index] = "null" Next WHILE StringLen($Variable[0]) <> 5 AND StringLen($Variable[1]) <> 5 AND StringLen($Variable[2]) <> 5 AND StringLen($Variable[3]) <> 5 AND StringLen($Variable[4]) <> 5;Checks for correct number of chractors in each block of the Variable. FOR $Index = 0 to 4 Step 1 $Variable[$Index] = InputBox("Variable Entry, Box " & $Index + 1 & " of 5.", "Please enter block " & $Index + 1 & " of your 5 block Variable:" & @CRLF, "", " M5", 300, 162) WHILE StringLen($Variable[$Index]) <> 5 = StringIsAlNum($Variable[$Index]) $Variable[$Index] = InputBox("Variable Entry, Box " & $Index + 1 & " of 5.", "Please re-enter block " & $Index + 1 & " of your 5 block Variable:" & @CRLF , $Variable[$Index], " M5", 300, 162) WEND NEXT WEND 1. If the user clicks cancel on the block 1 of 5 ;then it goes to block 2 of 5. 2. If the user click cancel on all blocks, it loops back and asks for block 1 again. 3. If the user inputs any symbols or the legnth is not 5 charactors it will ask the "re-enter" dialog. Any ideas on how I can disable the cancel button, or modify the script to loop that current block if the cancel button is pressed? Any input would be appreciated, Thank you! Edited April 5, 2005 by duomenox Link to comment Share on other sites More sharing options...
Kerberuz Posted April 5, 2005 Share Posted April 5, 2005 Hello everyone,I have a script that asks for user input. I am not using the GUI Controls as it would take a much longer time to write.I have a couple input boxes that I am asking the user to input 5 sets alpha numeric values of 5 digits each. I am then checking the strings to make sure they are 5 charactors and that all charactors are alpha numeric (no symbols).Here is my code:;Declare and Set the $Variable[Array] Dim $Variable[5] For $Index = 0 to 4 Step 1 $Variable[$Index] = "null" Next WHILE StringLen($Variable[0]) <> 5 AND StringLen($Variable[1]) <> 5 AND StringLen($Variable[2]) <> 5 AND StringLen($Variable[3]) <> 5 AND StringLen($Variable[4]) <> 5;Checks for correct number of chractors in each block of the Variable. FOR $Index = 0 to 4 Step 1 $Variable[$Index] = InputBox("Variable Entry, Box " & $Index + 1 & " of 5.", "Please enter block " & $Index + 1 & " of your 5 block Variable:" & @CRLF, "", " M5", 300, 162) WHILE StringLen($Variable[$Index]) <> 5 = StringIsAlNum($Variable[$Index]) $Variable[$Index] = InputBox("Variable Entry, Box " & $Index + 1 & " of 5.", "Please re-enter block " & $Index + 1 & " of your 5 block Variable:" & @CRLF , $Variable[$Index], " M5", 300, 162) WEND NEXT WEND1. If the user clicks cancel on the block 1 of 5 ;then it goes to block 2 of 5.2. If the user click cancel on all blocks, it loops back and asks for block 1 again.3. If the user inputs any symbols or the legnth is not 5 charactors it will ask the "re-enter" dialog.Any ideas on how I can disable the cancel button, or modify the script to loop that current block if the cancel button is pressed?Any input would be appreciated, Thank you!<{POST_SNAPBACK}>Try this... I left some extra code for the _ArrayDisplay, so you can see that it doesn't mess with your array.#include <array.au3> ;Declare and Set the $Variable[Array] Dim $Variable[5] $Flag = 0 For $i = 0 to 4 Step 1 $Variable[$i] = "null" Next WHILE StringLen($Variable[0]) <> 5 AND StringLen($Variable[1]) <> 5 AND StringLen($Variable[2]) <> 5 AND StringLen($Variable[3]) <> 5 AND StringLen($Variable[4]) <> 5;Checks for correct number of chractors in each block of the Variable. FOR $Index = 0 to 4 Step 1 if $Flag = 1 then $Index = $Index -1 $Variable[$Index] = InputBox("Variable Entry, Box " & $Index + 1 & " of 5.", "Please enter block " & $Index + 1 & " of your 5 block Variable:" & @CRLF, "", " M5", 300, 162) if @Error = 1 Then $Flag = 1 Else $Flag = 0 EndIf WHILE StringLen($Variable[$Index]) <> 5 = StringIsAlNum($Variable[$Index]) $Variable[$Index] = InputBox("Variable Entry, Box " & $Index + 1 & " of 5.", "Please re-enter block " & $Index + 1 & " of your 5 block Variable:" & @CRLF , $Variable[$Index], " M5", 300, 162) WEND NEXT WEND _ArrayDisplay($Variable, "Test") Kerby Link to comment Share on other sites More sharing options...
Developers Jos Posted April 5, 2005 Developers Share Posted April 5, 2005 Any ideas on how I can disable the cancel button, or modify the script to loop that current block if the cancel button is pressed?Any input would be appreciated, Thank you!<{POST_SNAPBACK}>Don't understand exactly what you want to do in case of Cancel but heres an example that will exit the second While...wend loop when Cancel is pressed:;Declare and Set the $Variable[Array] Dim $Variable[5] For $Index = 0 To 4 Step 1 $Variable[$Index] = "null" Next While StringLen($Variable[0]) <> 5 And StringLen($Variable[1]) <> 5 And StringLen($Variable[2]) <> 5 And StringLen($Variable[3]) <> 5 And StringLen($Variable[4]) <> 5;Checks for correct number of chractors in each block of the Variable. For $Index = 0 To 4 Step 1 $Variable[$Index] = InputBox("Variable Entry, Box " & $Index + 1 & " of 5.", "Please enter block " & $Index + 1 & " of your 5 block Variable:" & @CRLF, "", " M5", 300, 162) While StringLen($Variable[$Index]) <> 5 = StringIsAlNum($Variable[$Index]) $Variable[$Index] = InputBox("Variable Entry, Box " & $Index + 1 & " of 5.", "Please re-enter block " & $Index + 1 & " of your 5 block Variable:" & @CRLF, $Variable[$Index], " M5", 300, 162) If @error = 1 then exitloop WEnd Next WEnd SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
ShelbySue Posted April 5, 2005 Share Posted April 5, 2005 Here is a re-write to accomplish what you want. Some of this is spread out to make the logic more readable. ;Declare and Set the $Variable[Array] Dim $Variable[5] For $Index = 0 to 4 Step 1 $Variable[$Index] = "null" Next $Index = 0 $All_Done = 1 WHILE 1 WHILE 1 IF (StringLen($Variable[$Index]) = 5 ) and ( StringIsAlNum($Variable[$Index])) then exitloop $All_Done = 0 $Pmt = "Please enter block " & $Index + 1 & " of your 5 block Variable:" & @CRLF if $Variable[$Index] = "null" then $Dft = "[ENTER 5 DIGIT ALPH-NUMERIC]" $Rslt = InputBox("Variable Entry, Box " & $Index + 1 & " of 5.", $Pmt, $Dft, " M5", 300, 162) if @Error <> 0 then ExitLoop if $Dft <> $Rslt then $Variable[$index] = $Rslt WEND $Index = $Index + 1 if $Index > 4 then iF $All_Done then ExitLoop $Index = 0 $All_Done = 1 endif WEND Link to comment Share on other sites More sharing options...
Guest duomenox Posted April 5, 2005 Share Posted April 5, 2005 Thanks for all your input everyone. I was able to get it working with the suggestions everyone made. Sorry about the messy script, I've been in such a hurry trying toget this done I have taken some extra liberties with cleanliness :-P Again, thank you for your help! 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