youtuber Posted May 9, 2017 Share Posted May 9, 2017 (edited) I do not want to separate upper and lower case letters expandcollapse popup#include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Dim $aEditRead $Form1 = GUICreate("Form1", 581, 352, 192, 125) $Edit1 = GUICtrlCreateEdit("", 24, 32, 145, 225) GUICtrlSetData(-1, "Autoit" & @CRLF & "autoit" & @CRLF & "autoitscript" & @CRLF & "autoitscript" & @CRLF & "123" & @CRLF & "123" & @CRLF & "Autoitscript" & @CRLF & "autoitscript.com" & @CRLF & "autoitscript.coM" & @CRLF & "Autoitscript" & @CRLF & "123a" & @CRLF & "123A" & @CRLF & "AutoitscripT") $Edit2 = GUICtrlCreateEdit("" & @CRLF, 184, 32, 145, 225, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL, $WS_VSCROLL)) GUICtrlSetData(-1, "") $Button1 = GUICtrlCreateButton("Delete similar", 24, 296, 70, 33) $Label2 = GUICtrlCreateLabel("", 208, 272, 46, 17) $Button2 = GUICtrlCreateButton("Copy", 200, 296, 75, 33) $Edit3 = GUICtrlCreateEdit("" & @CRLF, 344, 32, 185, 225, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL, $WS_VSCROLL)) $Label1 = GUICtrlCreateLabel("Similar ones", 368, 272, 97, 24) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _deletesimilar() EndSwitch WEnd Func _deletesimilar() $aEditRead = StringSplit(StringStripCR(GUICtrlRead($Edit1)), @LF,2) $aUniques=_ArrayUnique($aEditRead) For $i = 1 To $aUniques[0] GUICtrlSetData($Edit2, $aUniques[$i] & @CRLF, 1) GUICtrlSetData($Label2, "Deleted") Next _ArraySort($aEditRead) For $i = UBound($aEditRead) - 1 To 1 Step -1 If $aEditRead[$i] = $aEditRead[$i - 1] Then GUICtrlSetData($Edit3, $aEditRead[$i] & @CRLF, 1) Next EndFunc Edited May 9, 2017 by youtuber Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 9, 2017 Moderators Share Posted May 9, 2017 I do not know what you mean by separate, running your script didn't give me any more clarity. If a upper/lower case makes a difference in keeping it versus deleting it, use the case sensitivity in _ArrayUnique (4th Param) youtuber 1 Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
youtuber Posted May 10, 2017 Author Share Posted May 10, 2017 Thank you for the answer Exactly how to do it? https://www.autoitscript.com/autoit3/docs/libfunctions/_ArrayUnique.htm $iCase [optional] Flag to indicate if the operations should be case sensitive. $aUniques = _ArrayUnique($aEditRead,0,0,$iCase,0) Link to comment Share on other sites More sharing options...
Floops Posted May 10, 2017 Share Posted May 10, 2017 (edited) If I had to guess I would say like this $aUniques = _ArrayUnique($aEditRead, 0, 0, 1, 0) Set the flag to either 0 or 1. 0 means it's case-insensitive and 1 means that it's case-sensitive. Edited May 10, 2017 by Floops youtuber 1 Link to comment Share on other sites More sharing options...
youtuber Posted May 10, 2017 Author Share Posted May 10, 2017 Thank you for your answers I'm getting an error Line 36: GUICtrlSetData($Edit2, $aUniques[$i] & @CRLF, 1) expandcollapse popup#include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Dim $aEditRead $Form1 = GUICreate("Form1", 581, 352, 192, 125) $Edit1 = GUICtrlCreateEdit("", 24, 32, 145, 225) GUICtrlSetData(-1, "Autoit" & @CRLF & "autoit" & @CRLF & "autoitscript" & @CRLF & "autoitscript" & @CRLF & "123" & @CRLF & "123" & @CRLF & "Autoitscript" & @CRLF & "autoitscript.com" & @CRLF & "autoitscript.coM" & @CRLF & "Autoitscript" & @CRLF & "123a" & @CRLF & "123A" & @CRLF & "AutoitscripT") $Edit2 = GUICtrlCreateEdit("" & @CRLF, 184, 32, 145, 225, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL, $WS_VSCROLL)) GUICtrlSetData(-1, "") $Button1 = GUICtrlCreateButton("Delete similar", 24, 296, 70, 33) $Label2 = GUICtrlCreateLabel("", 208, 272, 46, 17) $Button2 = GUICtrlCreateButton("Copy", 200, 296, 75, 33) $Edit3 = GUICtrlCreateEdit("" & @CRLF, 344, 32, 185, 225, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL, $WS_VSCROLL)) $Label1 = GUICtrlCreateLabel("Similar ones", 368, 272, 97, 24) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _deletesimilar() EndSwitch WEnd Func _deletesimilar() $aEditRead = StringSplit(StringStripCR(GUICtrlRead($Edit1)), @LF,2) ;~ $aUniques=_ArrayUnique($aEditRead) $aUniques = _ArrayUnique($aEditRead, 0, 0, 1, 0) For $i = 1 To $aUniques[0] GUICtrlSetData($Edit2, $aUniques[$i] & @CRLF, 1) GUICtrlSetData($Label2, "Deleted") Next _ArraySort($aEditRead) For $i = UBound($aEditRead) - 1 To 1 Step -1 If $aEditRead[$i] = $aEditRead[$i - 1] Then GUICtrlSetData($Edit3, $aEditRead[$i] & @CRLF, 1) Next EndFunc Link to comment Share on other sites More sharing options...
Floops Posted May 10, 2017 Share Posted May 10, 2017 (edited) @youtuber Try this line instead $aUniques = _ArrayUnique($aEditRead, 0, 0, 1, 1) Edited May 10, 2017 by Floops youtuber 1 Link to comment Share on other sites More sharing options...
youtuber Posted May 10, 2017 Author Share Posted May 10, 2017 Thanks How can i find deleted items? _ArraySort($aEditRead) For $i = UBound($aEditRead) - 1 To 1 Step -1 If $aEditRead[$i] = $aEditRead[$i - 1] Then GUICtrlSetData($Edit3, $aEditRead[$i] & @CRLF, 1) Next Link to comment Share on other sites More sharing options...
UEZ Posted May 10, 2017 Share Posted May 10, 2017 Something like this here? expandcollapse popup#include <Array.au3> #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Dim $aEditRead $Form1 = GUICreate("Form1", 581, 352, 192, 125) $Edit1 = GUICtrlCreateEdit("", 24, 32, 145, 225) GUICtrlSetData(-1, "Autoit" & @CRLF & "autoit" & @CRLF & "autoitscript" & @CRLF & "autoitscript" & @CRLF & "123" & @CRLF & "123" & @CRLF & "Autoitscript" & @CRLF & "autoitscript.com" & @CRLF & "autoitscript.coM" & @CRLF & "Autoitscript" & @CRLF & "123a" & @CRLF & "123A" & @CRLF & "AutoitscripT") $Edit2 = GUICtrlCreateEdit("" & @CRLF, 184, 32, 145, 225, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL, $WS_VSCROLL)) GUICtrlSetData(-1, "") $Button1 = GUICtrlCreateButton("Delete similar", 24, 296, 70, 33) $Label2 = GUICtrlCreateLabel("", 208, 272, 46, 17) $Button2 = GUICtrlCreateButton("Copy", 200, 296, 75, 33) $Edit3 = GUICtrlCreateEdit("" & @CRLF, 344, 32, 185, 225, BitOR($ES_MULTILINE, $ES_AUTOVSCROLL, $WS_VSCROLL)) $Label1 = GUICtrlCreateLabel("Similar ones", 368, 272, 97, 24) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 _deletesimilar() EndSwitch WEnd Func _deletesimilar() $aEditRead = StringSplit(StringStripCR(GUICtrlRead($Edit1)), @LF,2) $aUniques=_ArrayUnique($aEditRead, 0, 0, 1) $aUniques2=_ArrayUnique($aEditRead) For $i = 1 To UBound($aUniques) - 1 $aPos = _ArrayFindAll($aEditRead, $aUniques[$i], 0, 0, 1) If UBound($aPos) > 1 Then GUICtrlSetData($Edit2, $aUniques[$i] & @CRLF, 1) Next GUICtrlSetData($Label2, "Deleted") Dim $aSimilar[UBound($aEditRead)] $c = 0 For $i = 1 To UBound($aUniques2) - 1 $aPos = _ArrayFindAll($aEditRead, $aUniques2[$i]) If UBound($aPos) > 0 Then For $j = 0 To UBound($aPos) - 1 $aSimilar[$c] = $aEditRead[$aPos[$j]] $c += 1 Next EndIf Next ReDim $aSimilar[$c] $aUniques3=_ArrayUnique($aSimilar, 0, 0, 1) _ArraySort($aUniques3) For $i = 1 to UBound($aUniques3) - 1 GUICtrlSetData($Edit3, $aUniques3[$i] & @CRLF, 1) Next EndFunc youtuber 1 Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
youtuber Posted May 11, 2017 Author Share Posted May 11, 2017 When many words are added It works very slowly Is there a solution for this? It also uses a lot of CPU This is my problem can be solving? ProcessSetPriority(@AutoItPid,4) or $dll=DLlOpen("ntdll.dll") While 1 _HighPrecisionSleep(100*2,$dll) WEnd Func _HighPrecisionSleep($iMicroSeconds,$hDll=False) Local $hStruct, $bLoaded If Not $hDll Then $hDll=DllOpen("ntdll.dll") $bLoaded=True EndIf $hStruct=DllStructCreate("int64 time;") DllStructSetData($hStruct,"time",-1*($iMicroSeconds*10)) DllCall($hDll,"dword","ZwDelayExecution","int",0,"ptr",DllStructGetPtr($hStruct)) If $bLoaded Then DllClose($hDll) EndFunc 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