Negro Posted January 17, 2012 Share Posted January 17, 2012 (edited) How to list specific files in the extensions folder and copy it to another folder?for example :expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GuiComboBoxEx.au3> #include <File.au3> Opt("GUICloseOnESC", 1) Opt("GUIOnEventMode", 1) Global $fTypes = "au3|doc|docx|txt|zip|rar|lnk" $Gui = GUICreate("Desktop Cleaner V1.03", 385, 185, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) GUISetOnEvent($GUI_EVENT_CLOSE, "Event", $Gui) $LV = GUICtrlCreateListView("Desktop Files", 5, 10, 280, 140, -1, BitOR($LVS_EX_CHECKBOXES, $WS_EX_CLIENTEDGE)) FindDesktopFiles() GUICtrlCreateGroup("File Types", 290, 5, 90, 45) $Combo = GUICtrlCreateCombo("All Types", 300, 20, 70, 20, $CBS_DROPDOWNLIST) GUICtrlSetOnEvent(-1, "Event") GUICtrlSetData(-1, $fTypes, "All Types") $SelectAll = GUICtrlCreateButton("Select All", 290, 65, 90, 25) GUICtrlSetOnEvent(-1, "Event") $SelectNone = GUICtrlCreateButton("Select None", 290, 95, 90, 25) GUICtrlSetOnEvent(-1, "Event") $InvertSeleced = GUICtrlCreateButton("Invert Selected", 290, 125, 90, 25) GUICtrlSetOnEvent(-1, "Event") $SendToBin = GUICtrlCreateButton("Send Selected File(s) To Recycle Bin", 5, 155, 375, 25) GUICtrlSetOnEvent(-1, "Event") GUICtrlSetFont(-1, 10, 700) GUISetState(@SW_SHOW, $Gui) While 1 Sleep(100) WEnd Func Event() Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE Exit Case $Combo FindDesktopFiles(GUICtrlRead($Combo)) Case $SelectAll For $s = 0 To _GUICtrlListView_GetItemCount($LV) - 1 _GUICtrlListView_SetItemChecked($LV, $s, True) Next Case $SelectNone For $s = 0 To _GUICtrlListView_GetItemCount($LV) - 1 _GUICtrlListView_SetItemChecked($LV, $s, False) Next Case $InvertSeleced For $s = 0 To _GUICtrlListView_GetItemCount($LV) - 1 If _GUICtrlListView_GetItemChecked($LV, $s) Then _GUICtrlListView_SetItemChecked($LV, $s, False) Else _GUICtrlListView_SetItemChecked($LV, $s, True) EndIf Next Case $SendToBin For $s = 0 To _GUICtrlListView_GetItemCount($LV) - 1 If _GUICtrlListView_GetItemChecked($LV, $s) Then _ FileRecycle(@DesktopDir & "\" & _GUICtrlListView_GetItemText($LV, $s, 0)) Next FindDesktopFiles(GUICtrlRead($Combo)) EndSwitch EndFunc Func FindDesktopFiles($sType = "All Types") _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($LV)) Local $ext = "*." & $sType, $FL2A If $sType = "All Types" Then $ext = "*.*" $FL2A = _FileListToArray(@DesktopDir, $ext, 1) If Not @error Then For $i = 1 To $FL2A[0] If $sType = "All Types" Then Local $SST = StringSplit($fTypes, "|") For $j = 1 To $SST[0] If $SST[$j] = StringMid($FL2A[$i], StringInStr($FL2A[$i], ".", 0, -1) + 1) Then _ GUICtrlCreateListViewItem($FL2A[$i], $LV) Next ElseIf $sType <> "All Types" Then If $sType = StringMid($FL2A[$i], StringInStr($FL2A[$i], ".", 0, -1) + 1) Then _ GUICtrlCreateListViewItem($FL2A[$i], $LV) EndIf Next _GUICtrlListView_SetColumnWidth($LV, 0, $LVSCW_AUTOSIZE) EndIf EndFunc Edited January 19, 2012 by Negro [font="'Times New Roman"]Everything will be fine[/font] Link to comment Share on other sites More sharing options...
jaberwacky Posted January 17, 2012 Share Posted January 17, 2012 (edited) FileCopy ( "source", "dest" [, flag] ) Edited January 17, 2012 by LaCastiglione Helpful Posts and Websites: AutoIt3 Variables and Function Parameters MHz | AutoIt Wiki | Using the GUIToolTip UDF BrewManNH | Can't find what you're looking for on the Forum? Link to comment Share on other sites More sharing options...
Negro Posted January 17, 2012 Author Share Posted January 17, 2012 (edited) file extensions filter ? Edited January 17, 2012 by Negro [font="'Times New Roman"]Everything will be fine[/font] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 17, 2012 Moderators Share Posted January 17, 2012 Negro,If you want to search for files with multiple extensions, look at the RecFileListToArray UDF in my sig. If that is not what you are looking for, can you please explain more clearly. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Negro Posted January 17, 2012 Author Share Posted January 17, 2012 (edited) Listing extensions with your function [RecFileListToArray UDF] As the above examplehow do make it ?My English is not good Edited January 17, 2012 by Negro [font="'Times New Roman"]Everything will be fine[/font] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 17, 2012 Moderators Share Posted January 17, 2012 Negro, Have you looked at the thread and the function header? Here is an example: #include <Array.au3> #include "RecFileListToArray.au3" ; Search for files with .sys and .dll extensions only $aList = _RecFileListToArray("C:\Windows\System32\", "*.sys;*.dll", 1) _ArrayDisplay($aList) All clear? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Negro Posted January 17, 2012 Author Share Posted January 17, 2012 (edited) Melba23,For example, the beautiful but this is how it should,please Edited March 8, 2013 by Negro [font="'Times New Roman"]Everything will be fine[/font] Link to comment Share on other sites More sharing options...
KaFu Posted January 17, 2012 Share Posted January 17, 2012 Are you looking for something more like this? Quick pseudo-code, of course needs further work. $sTargetFolder = FileSelectFolder() For $s = 0 To _GUICtrlListView_GetItemCount($LV) - 1 if _GUICtrlListView_GetItemChecked($LV, $s) Then FileCopy(@DesktopDir & "" & _GUICtrlListView_GetItemText(),$sTargetFolder) endif Next Negro 1 OS: Win10-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2024-Oct-13) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Oct-13) HMW - Hide my Windows (2024-Oct-19) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2024-Oct-20) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 17, 2012 Moderators Share Posted January 17, 2012 Negro, Try this: expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GuiComboBoxEx.au3> #include <File.au3> #include "RecFileListToArray.au3" ; You need this <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< Opt("GUICloseOnESC", 1) Opt("GUIOnEventMode", 1) Global $fTypes = "au3|doc|docx|txt|zip|rar|lnk" $Gui = GUICreate("Desktop Cleaner V1.03", 385, 185, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) GUISetOnEvent($GUI_EVENT_CLOSE, "Event", $Gui) $LV = GUICtrlCreateListView("Desktop Files", 5, 10, 280, 140, -1, BitOR($LVS_EX_CHECKBOXES, $WS_EX_CLIENTEDGE)) FindDesktopFiles() GUICtrlCreateGroup("File Types", 290, 5, 90, 45) $Combo = GUICtrlCreateCombo("All Types", 300, 20, 70, 20, $CBS_DROPDOWNLIST) GUICtrlSetOnEvent(-1, "Event") GUICtrlSetData(-1, $fTypes, "All Types") $SelectAll = GUICtrlCreateButton("Select All", 290, 65, 90, 25) GUICtrlSetOnEvent(-1, "Event") $SelectNone = GUICtrlCreateButton("Select None", 290, 95, 90, 25) GUICtrlSetOnEvent(-1, "Event") $InvertSeleced = GUICtrlCreateButton("Invert Selected", 290, 125, 90, 25) GUICtrlSetOnEvent(-1, "Event") $SendToBin = GUICtrlCreateButton("Send Selected File(s) To Recycle Bin", 5, 155, 375, 25) GUICtrlSetOnEvent(-1, "Event") GUICtrlSetFont(-1, 10, 700) GUISetState(@SW_SHOW, $Gui) While 1 Sleep(100) WEnd Func Event() Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE Exit Case $Combo FindDesktopFiles(GUICtrlRead($Combo)) Case $SelectAll For $s = 0 To _GUICtrlListView_GetItemCount($LV) - 1 _GUICtrlListView_SetItemChecked($LV, $s, True) Next Case $SelectNone For $s = 0 To _GUICtrlListView_GetItemCount($LV) - 1 _GUICtrlListView_SetItemChecked($LV, $s, False) Next Case $InvertSeleced For $s = 0 To _GUICtrlListView_GetItemCount($LV) - 1 If _GUICtrlListView_GetItemChecked($LV, $s) Then _GUICtrlListView_SetItemChecked($LV, $s, False) Else _GUICtrlListView_SetItemChecked($LV, $s, True) EndIf Next Case $SendToBin For $s = 0 To _GUICtrlListView_GetItemCount($LV) - 1 If _GUICtrlListView_GetItemChecked($LV, $s) Then _ FileRecycle(@DesktopDir & "" & _GUICtrlListView_GetItemText($LV, $s, 0)) Next FindDesktopFiles(GUICtrlRead($Combo)) EndSwitch EndFunc Func FindDesktopFiles($sType = "All Types") _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($LV)) Switch $sType Case "All Types" $ext = "*.au3;*.doc;*.docx;*.txt;*.zip;*.rar;*.lnk" ; Multiple extensions <<<<<<<<<<<<<< Case Else $ext = "*." & $sType ; Single extension <<<<<<<<<<<<<<<<<<<< EndSwitch $FL2A = _RecFileListToArray(@DesktopDir, $ext, 1) ; Search here <<<<<<<<<<<<<<<<<<<<<<<<<< If Not @error Then For $i = 1 To $FL2A[0] GUICtrlCreateListViewItem($FL2A[$i], $LV) Next _GUICtrlListView_SetColumnWidth($LV, 0, $LVSCW_AUTOSIZE) EndIf EndFunc M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Negro Posted January 17, 2012 Author Share Posted January 17, 2012 (edited) KaFu,Yes As in the picture above. $sTargetFolder = FileSelectFolder() For $s = 0 To _GUICtrlListView_GetItemCount($LV) - 1 if _GUICtrlListView_GetItemChecked($LV, $s) Then FileCopy(@DesktopDir & "" & _GUICtrlListView_GetItemText(),$sTargetFolder) endif Next FileRecycle(@DesktopDir&""&_GUICtrlListView_GetItemText($LV,$s, 0))I would like to improve the way you sayMelba23,I think you, understand me but do not delete filesCopy the files where I want As kaFu says, I want to do. Edited January 17, 2012 by Negro [font="'Times New Roman"]Everything will be fine[/font] Link to comment Share on other sites More sharing options...
Negro Posted January 19, 2012 Author Share Posted January 19, 2012 Please help had very little. [font="'Times New Roman"]Everything will be fine[/font] Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted January 19, 2012 Moderators Share Posted January 19, 2012 Negro,Sie wurden sehr faul überall, so können Sie herausfinden, was geändert wurde. Trans: You have been very lazy throughout, so you can work out what has been changed.expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiListView.au3> #include <GuiComboBoxEx.au3> #include <File.au3> #include "RecFileListToArray.au3" Opt("GUICloseOnESC", 1) Opt("GUIOnEventMode", 1) Global $fTypes = "au3|doc|docx|txt|zip|rar|lnk" $Gui = GUICreate("Desktop Cleaner V1.03", 385, 185, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) GUISetOnEvent($GUI_EVENT_CLOSE, "Event", $Gui) $LV = GUICtrlCreateListView("Desktop Files", 5, 10, 280, 140, -1, BitOR($LVS_EX_CHECKBOXES, $WS_EX_CLIENTEDGE)) FindDesktopFiles() GUICtrlCreateGroup("File Types", 290, 5, 90, 45) $Combo = GUICtrlCreateCombo("All Types", 300, 20, 70, 20, $CBS_DROPDOWNLIST) GUICtrlSetOnEvent(-1, "Event") GUICtrlSetData(-1, $fTypes, "All Types") $SelectAll = GUICtrlCreateButton("Select All", 290, 65, 90, 25) GUICtrlSetOnEvent(-1, "Event") $SelectNone = GUICtrlCreateButton("Select None", 290, 95, 90, 25) GUICtrlSetOnEvent(-1, "Event") $InvertSeleced = GUICtrlCreateButton("Invert Selected", 290, 125, 90, 25) GUICtrlSetOnEvent(-1, "Event") $CopyTo = GUICtrlCreateButton("Move Selected File(s)", 5, 155, 375, 25) GUICtrlSetOnEvent(-1, "Event") GUICtrlSetFont(-1, 10, 700) GUISetState(@SW_SHOW, $Gui) While 1 Sleep(100) WEnd Func Event() Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE Exit Case $Combo FindDesktopFiles(GUICtrlRead($Combo)) Case $SelectAll For $s = 0 To _GUICtrlListView_GetItemCount($LV) - 1 _GUICtrlListView_SetItemChecked($LV, $s, True) Next Case $SelectNone For $s = 0 To _GUICtrlListView_GetItemCount($LV) - 1 _GUICtrlListView_SetItemChecked($LV, $s, False) Next Case $InvertSeleced For $s = 0 To _GUICtrlListView_GetItemCount($LV) - 1 If _GUICtrlListView_GetItemChecked($LV, $s) Then _GUICtrlListView_SetItemChecked($LV, $s, False) Else _GUICtrlListView_SetItemChecked($LV, $s, True) EndIf Next Case $CopyTo $sDest = FileSelectFolder("Select Destination Folder", "") If $sDest Then For $s = 0 To _GUICtrlListView_GetItemCount($LV) - 1 If _GUICtrlListView_GetItemChecked($LV, $s) Then FileMove(@DesktopDir & "" & _GUICtrlListView_GetItemText($LV, $s, 0), $sDest & "") EndIf Next FindDesktopFiles(GUICtrlRead($Combo)) EndIf EndSwitch EndFunc Func FindDesktopFiles($sType = "All Types") _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($LV)) Switch $sType Case "All Types" $ext = "*.au3;*.doc;*.docx;*.txt;*.zip;*.rar;*.lnk" Case Else $ext = "*." & $sType EndSwitch $FL2A = _RecFileListToArray(@DesktopDir, $ext, 1) If Not @error Then For $i = 1 To $FL2A[0] GUICtrlCreateListViewItem($FL2A[$i], $LV) Next _GUICtrlListView_SetColumnWidth($LV, 0, $LVSCW_AUTOSIZE) EndIf EndFuncM23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Negro Posted January 19, 2012 Author Share Posted January 19, 2012 Melba23, thank you very much I've tried it but didn't. Was exactly what I want best regards.. [font="'Times New Roman"]Everything will be fine[/font] 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