angel83 Posted 5 hours ago Posted 5 hours ago I have a problem that I can't solve, I would appreciate your help The problem is that the same names are repeated. when I search in subfolders. Example: ProgramFiles\example\folder\a1\gimp.exe ProgramFiles\example\folder\b2\gimp.exe Add the 2 executables to the ListView 1 gimp.exe 2 gimp.exe how to prevent this from happening. here is my code: expandcollapse popup#include <GuiListView.au3> #include <GUIConstants.au3> #include <WINAPI.au3> #include <misc.au3> #include <ColorConstants.au3> #include <GuiListView.au3> #include <MsgBoxConstants.au3> #include <Array.au3> #include <File.au3> #include <GuiComboBox.au3> #include <GuiConstantsEx.au3> #include <GuiEdit.au3> #include <GuiListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <Word.au3> Opt("GUIResizeMode", $GUI_DOCKAUTO) $hGUI = GUICreate("Test", 500, 800) GUISetBkColor(0xFFFF00) $iLVStyle = BitOR($LVS_REPORT, $LVS_SHOWSELALWAYS) $iLVExtStyle = BitOR($WS_EX_CLIENTEDGE, $LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT) $hListView = GUICtrlCreateListView("#|EXE NAME|", 34, 274, 350, 444, $iLVStyle, $iLVExtStyle) _GUICtrlListView_SetExtendedListViewStyle($hListView, BitOr($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT)) _GuiCtrlListView_SetColumnWidth($hListView,0,35) _GuiCtrlListView_SetColumnWidth($hListView,1,290) $AddButton = GUICtrlCreateButton("Add", 122, 242, 75, 23,$WS_BORDER) $RemButton = GUICtrlCreateButton("Delete", 202, 242, 75, 23,$WS_BORDER) $RemButton3 = GUICtrlCreateButton("Delete All", 298, 242, 88, 23,$WS_BORDER) GUISetState(@SW_SHOW, $hGUI) While 1 $msg = GUIGetMsg(1) Switch $msg[0] Case $GUI_EVENT_CLOSE Exit Case $AddButton REPIT() Case $RemButton _GUICtrlListView_DeleteItemsSelected($hListView) Case $RemButton3 _GUICtrlListView_DeleteAllItems($hListView) EndSwitch WEnd Func REPIT() Local $sBrowseFolder = FileSelectFolder ("Select Folder with Documents to merge", "", 4, @ScriptDir) IF @ERROR THEN Else _AddSelectFolder($sBrowseFolder) EndIf EndFunc Func _AddSelectFolder($_sFolderPath) Local $aFolderList = _FileListToArrayRec($_sFolderPath, "*exe", $FLTAR_FILES, $FLTAR_RECUR, $FLTAR_SORT) If @error Then Return "" For $i = 1 To $aFolderList[0] GUICtrlCreateListViewItem($i & "|" & StringRegExpReplace($aFolderList[$i], "^.*\\", "") , $hListView) Next EndFunc
ioa747 Posted 5 hours ago Posted 5 hours ago _ArrayUnique Returns the Elements from a column of a 1D or 2D array, removing all duplicates #include <Array.au3> _ArrayUnique ( Const ByRef $aArray [, $iColumn = 0 [, $iBase = 0 [, $iCase = 0 [, $iCount = $ARRAYUNIQUE_COUNT [, $iIntType = $ARRAYUNIQUE_AUTO]]]]] ) I know that I know nothing
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