youtuber Posted June 16, 2016 Share Posted June 16, 2016 #include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Dim $aArrayedit $Form1 = GUICreate("Form1", 264, 334, 379, 161) $Edit1 = GUICtrlCreateEdit("", 40, 32, 185, 225) GUICtrlSetData(-1, "192.168.1.1" & @CRLF & "192.168.2.1" & @CRLF & "192.168.0.1") $Button1 = GUICtrlCreateButton("Button1", 96, 272, 65, 33) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _arraysearchdell() EndSwitch WEnd Func _arraysearchdell() $aArrayedit = StringSplit(StringStripCR(GUICtrlRead($Edit1)), @LF) _ArraySearch($aArrayedit) For $i = UBound($aArrayedit) - 1 To 1 Step -1 If $aArrayedit[$i] = $aArrayedit[$i - 1] Then _ArrayDelete($aArrayedit, $i) ConsoleWrite($aArrayedit &@CRLF) Next EndFunc Link to comment Share on other sites More sharing options...
AutoBert Posted June 16, 2016 Share Posted June 16, 2016 a Editbox is a GuiControl, so use GuiControlDelete to delete this Control. What's the question? Link to comment Share on other sites More sharing options...
youtuber Posted June 16, 2016 Author Share Posted June 16, 2016 How to delete the same two? #include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Dim $aArrayedit $Form1_1 = GUICreate("Form1", 308, 338, 192, 125) $Edit1 = GUICtrlCreateEdit("", 24, 32, 121, 225) GUICtrlSetData(-1, "192.168.1.1" & @CRLF & "192.168.2.1" & @CRLF & "192.168.0.1" & @CRLF & "192.168.1.1" & @CRLF & "192.168.2.1" & @CRLF & "192.168.0.0") $Edit2 = GUICtrlCreateEdit("" & @CRLF, 160, 32, 129, 225, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL, $WS_VSCROLL)) GUICtrlSetData(-1, "") $Button1 = GUICtrlCreateButton("Button1", 96, 272, 65, 33) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _arraysearchdell() EndSwitch WEnd Func _arraysearchdell() $aArrayedit = StringSplit(StringStripCR(GUICtrlRead($Edit1)), @LF) _ArraySearch($aArrayedit,1) For $i = UBound($aArrayedit) - 1 To 1 Step -1 Sleep(500) If $aArrayedit[$i] = $aArrayedit[$i - 1] Then _ArrayDelete($aArrayedit, $i) GUICtrlSetData($Edit2, $aArrayedit[$i] & @CRLF, 1) Next EndFunc Link to comment Share on other sites More sharing options...
AutoBert Posted June 16, 2016 Share Posted June 16, 2016 I think simplest way is to use the func _ArrayUnique: Func _MakeArrayUnique() $aArrayedit = StringSplit(StringStripCR(GUICtrlRead($Edit1)), @LF,2) $aUnique=_ArrayUnique($aArrayedit) _ArraySort($aUnique,0,1) ;element 0 holds the count of IP's ;_ArrayDisplay($aUnique) For $i = 1 To $aUnique[0] GUICtrlSetData($Edit2, $aUnique[$i] & @CRLF, 1) Next EndFunc ;==>_MakeArrayUnique youtuber 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