youtuber 6 Posted June 18, 2019 If $aList[$n] is finished, it gives an error. How do I need to provide control for this? (22) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.: $ReadString = StringRegExp($aList[$n], '[a-zA-Z0-9_\\.-]+@[a-zA-Z0-9\-]+\.+[a-zA-Z0-9]{2,4}', 3) $ReadString = StringRegExp(^ ERROR #include <GUIConstantsEx.au3> #include <String.au3> #include <EditConstants.au3> $Form1 = GUICreate("Form1", 418, 387, 192, 124) $Edit1 = GUICtrlCreateEdit("", 8, 72, 329, 169) GUICtrlSetData($Edit1, "test1@mail.com" & @CRLF & "test2@mail.com") $Input1 = GUICtrlCreateInput("", 8, 32, 329, 21) $Button1 = GUICtrlCreateButton("Next Site", 16, 256, 75, 25) GUISetState(@SW_SHOWNA) $n = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $aList = StringSplit(GUICtrlRead($Edit1), @CRLF, $STR_ENTIRESPLIT) If GUICtrlRead($Button1) = "Next" Then $n += 1 $ReadString = StringRegExp($aList[$n], '[a-zA-Z0-9_\\.-]+@[a-zA-Z0-9\-]+\.+[a-zA-Z0-9]{2,4}', 3) If IsArray($ReadString) Then GUICtrlSetData($Input1, $ReadString[0]) GUICtrlSetData($Button1, "Pass") Else GUICtrlSetData($Button1, "Next") EndIf EndSwitch WEnd Share this post Link to post Share on other sites
argumentum 566 Posted June 18, 2019 #include <GUIConstantsEx.au3> #include <String.au3> #include <EditConstants.au3> $Form1 = GUICreate("Form1", 418, 387, 192, 124) $Edit1 = GUICtrlCreateEdit("", 8, 72, 329, 169) GUICtrlSetData($Edit1, "test1@mail.com" & @CRLF & "test2@mail.com") $Input1 = GUICtrlCreateInput("", 8, 32, 329, 21) $Button1 = GUICtrlCreateButton("Next Site", 16, 256, 75, 25) GUISetState(@SW_SHOWNA) $n = 0 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $aList = StringSplit(GUICtrlRead($Edit1), @CRLF, $STR_ENTIRESPLIT) If GUICtrlRead($Button1) = "Next" Then $n += 1 If $n > $aList[0] Then GUICtrlSetData($Button1, "=P") ContinueLoop EndIf $ReadString = StringRegExp($aList[$n], '[a-zA-Z0-9_\\.-]+@[a-zA-Z0-9\-]+\.+[a-zA-Z0-9]{2,4}', 3) If IsArray($ReadString) Then GUICtrlSetData($Input1, $ReadString[0]) GUICtrlSetData($Button1, "Pass") Else GUICtrlSetData($Button1, "Next") EndIf EndSwitch WEnd 1 youtuber reacted to this Follow the link to see my signature's stuff. Share this post Link to post Share on other sites
Nine 993 Posted June 18, 2019 To be logical, should the StringSplit be outside the loop ? And when you reach the end, should the Button1 be disabled ? Not much of a signature but working on it... Spoiler Block all input without UAC Save/Retrieve Images to/from Text Tool to search content in au3 files Date Range Picker Sudoku Game 2020 Overlapped Named Pipe IPC x64 Bitwise Operations Multi-keyboards HotKeySet Fast and simple WCD IPC Multiple Folder Selector GIF Animation (cached) Share this post Link to post Share on other sites
youtuber 6 Posted June 18, 2019 @argumentum Actually instance is seamless nice, thanks. Actually, should GUICtrlSetData ($Button1, "Done") and disable the button like this Case $Button1 $aList = StringSplit(GUICtrlRead($Edit1), @CRLF, $STR_ENTIRESPLIT) If GUICtrlRead($Button1) = "Next" Then $n += 1 If $n > $aList[0] Then GUICtrlSetData($Button1, "Done") GUICtrlSetState($Button1, $GUI_DISABLE) ContinueLoop EndIf $ReadString = StringRegExp($aList[$n], '[a-zA-Z0-9_\\.-]+@[a-zA-Z0-9\-]+\.+[a-zA-Z0-9]{2,4}', 3) If IsArray($ReadString) Then GUICtrlSetData($Input1, $ReadString[0]) GUICtrlSetData($Button1, "Pass") Else GUICtrlSetData($Button1, "Next") EndIf @Nine Thanks for trying to find out another example would be nice. 1 argumentum reacted to this Share this post Link to post Share on other sites