youtuber Posted August 21, 2016 Share Posted August 21, 2016 How to folder names from the list to get the combo? expandcollapse popup#include <File.au3> #include <ComboConstants.au3> #include <Array.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 316, 185) $Button1 = GUICtrlCreateButton("Move", 160, 136, 75, 25) $Button2 = GUICtrlCreateButton("Count", 25, 136, 75, 25) $Label1 = GUICtrlCreateLabel("Total desktop :", 24, 24, 118, 17) $Label2 = GUICtrlCreateLabel("", 144, 24, 156, 17) $Label4 = GUICtrlCreateLabel("", 32, 48, 228, 17) $Combo1 = GUICtrlCreateCombo("*.TXT", 32, 88, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "*.JPG|*.PNG|*.GİF") GUISetState(@SW_SHOW) While 1 Sleep(10) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $Button1 _Move() Case $Button2 _count() EndSwitch WEnd Func _count() Local $extension = GUICtrlRead($Combo1) Local $FileList = _FileListToArray(@ScriptDir, $extension, 1) If IsArray($FileList) Then For $i = 0 To UBound($FileList[0]) Sleep(20) GUICtrlSetData ($Label2, $FileList[$i] & $extension & " Is the file") For $as = 1 To UBound($FileList) -1 Sleep(250) GUICtrlSetData ($Label4, $FileList[$as]) Next GUICtrlSetData ($Label4, "") Next Else MsgBox(64,"","On the desktop "& $extension &" Not found!") EndIf EndFunc Func _Move() Local $extension = GUICtrlRead($Combo1) Local $FileList = _FileListToArray(@ScriptDir, $extension, 1) For $Move = 0 To UBound($FileList) -1 If FileExists(@DesktopDir & "\& $extension &\") = 1 Then FileMove(@ScriptDir & '\' & $FileList[$Move],@DesktopDir & "\& $extension & My files\" & $FileList[$Move], 9) GUICtrlSetData ($Label4, "Moved") Else DirCreate(@DesktopDir & "\& $extension & My files") FileMove(@ScriptDir & '\' & $FileList[$Move],@DesktopDir & "\& $extension & My files\" & $FileList[$Move], 9) GUICtrlSetData ($Label4, "Moved") EndIf Next EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 21, 2016 Moderators Share Posted August 21, 2016 youtuber, I am afraid that you question makes no sense to me. Are you asking how to get the sub-folder names from within @ScriptDir? And why would you want to put folder names into a combo which currently holds a list of file extensions? Please explain a little more clearly what you are trying to do. M23 youtuber 1 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...
youtuber Posted August 21, 2016 Author Share Posted August 21, 2016 I want to name the folder will only collect extensions an example, but I do not know expandcollapse popup#include <File.au3> #include <ComboConstants.au3> #include <Array.au3> #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Form1", 316, 185) $Button1 = GUICtrlCreateButton("Move", 160, 136, 75, 25) $Button2 = GUICtrlCreateButton("Count", 25, 136, 75, 25) $Label1 = GUICtrlCreateLabel("Total desktop :", 24, 24, 118, 17) $Label2 = GUICtrlCreateLabel("", 144, 24, 156, 17) $Label4 = GUICtrlCreateLabel("", 32, 48, 228, 17) $Combo1 = GUICtrlCreateCombo("TXT", 32, 88, 65, 25, BitOR($CBS_DROPDOWN,$CBS_AUTOHSCROLL)) GUICtrlSetData(-1, "JPG|PNG|GİF") GUISetState(@SW_SHOW) While 1 Sleep(10) $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $Button1 _Move() Case $Button2 _count() EndSwitch WEnd Func _count() Local $extension = GUICtrlRead($Combo1) Local $FileList = _FileListToArray(@ScriptDir, "*.", $extension, 1) If IsArray($FileList) Then For $i = 0 To UBound($FileList[0]) Sleep(20) GUICtrlSetData ($Label2, $FileList[$i] & " "& $extension & " Is the file") For $as = 1 To UBound($FileList) -1 Sleep(25) GUICtrlSetData ($Label4, $FileList[$as]) Next GUICtrlSetData ($Label4, "") Next Else MsgBox(64,"","On the desktop "& $extension &" Not found!") EndIf EndFunc Func _Move() Local $extension = GUICtrlRead($Combo1) Local $FileList = _FileListToArray(@ScriptDir, "*.", $extension, 1) For $Move = 0 To UBound($FileList) -1 If FileExists(@DesktopDir & "\" & $extension & "\") = 1 Then FileCopy(@ScriptDir & "\" & $FileList[$Move],@DesktopDir & "\" & $extension & " My files\" & $FileList[$Move], 9) GUICtrlSetData ($Label4, "Moved") Else DirCreate(@DesktopDir & "\" & $extension & " My files") FileCopy(@ScriptDir & "\" & $FileList[$Move], @DesktopDir & "\" & $extension & " My files\" & $FileList[$Move], 9) GUICtrlSetData ($Label4, "Moved") EndIf Next EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 21, 2016 Moderators Share Posted August 21, 2016 youtuber, Let me try to follow that code: - You look for files with a particular extension in @ScriptDir (you should really use "*" as the filter - the "." in the Help file parameter list is actually a period marking the end of the phrase). - If you find any then: -- Either count and then display their names, or -- Look for a folder on the desktop named as that extension (or create one if one is not found) and copy the found files into that folder. How is that as a description of what you are trying to do? M23 youtuber 1 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...
youtuber Posted August 21, 2016 Author Share Posted August 21, 2016 (edited) yes exactly right Is this code right? $FileList = _FileListToArray(@ScriptDir, ".", $extension, 1) Edit: problem solved thank you Local $FileList = _FileListToArray(@ScriptDir, "*." & $extension, 1) Edited August 21, 2016 by youtuber 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