youtuber Posted June 18, 2019 Share 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 Link to comment Share on other sites More sharing options...
argumentum Posted June 18, 2019 Share 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 youtuber 1 Follow the link to my code contribution ( and other things too ). FAQ - Please Read Before Posting. Link to comment Share on other sites More sharing options...
Nine Posted June 18, 2019 Share 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 ? “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
youtuber Posted June 18, 2019 Author Share 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. argumentum 1 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