Jump to content

FileOpenDialog and FileSelectFolder are not handling task. Function Multi-select for files and/or folders.


AIG
 Share

Recommended Posts

Hello!

I'm looking for a function in AutoIt that allows for multi-select of files and/or folders in a file dialog.

The function:

FileOpenDialog

allows for selecting one or multiple files, but doesn't provide the option to choose folders.

 

The function:

FileSelectFolder

only allows for selecting folders.

 

The function:

_WinAPI_OpenFileDlg

also doesn't support selecting both files and folders simultaneously.

 

The function:

_WinAPI_BrowseForFolderDlg

is one of the options that allows for selecting not only folders, but also files (by adding the $BIF_BROWSEINCLUDEFILES parameter), but it doesn't support selecting multiple files and/or folders. Another drawback is that the dialog window appears in an old tree-view style, which seems outdated.

The ultimate goal is to implement a multi-select function similar to FileOpenDialog or _WinAPI_OpenFileDlg, but with the ability to select multiple files, folders, or both at the same time.

In the end, we obtain a list of file and folder names that we have selected.

 

The function:

_WinAPI_DragQueryFileEx

handles this task perfectly, but using drag and drop as the primary method of file selection may not always be convenient, especially when the program window is maximized.

I am surprised that this functionality is not implemented in the standard or custom functions of AutoIt. Maybe I haven't searched well enough. If anyone has any suggestions or solutions for implementing multi-select for files and/or folders in AutoIt, I would greatly appreciate it. Thank you in advance for your help!

Link to comment
Share on other sites

  • AIG changed the title to FileOpenDialog and FileSelectFolder are not handling task. Function Multi-select for files and/or folders.
I don't think there's a native function to do this in AutoIt
This short script could help :

#include <Debug.au3>
#include <File.au3>
#include <MsgBoxConstants.au3>

Example()

Func Example()
    Local $sFileSelectFolder = FileSelectFolder("Select a folder", "")
    If @error Then
        MsgBox($MB_TOPMOST, "", "No folder was selected.")
        Exit
    EndIf

    Local $aArray = _FileListToArrayRec($sFileSelectFolder, "*", _
        $FLTAR_FILESFOLDERS, $FLTAR_NORECUR, $FLTAR_SORT, $FLTAR_FULLPATH)
    _DebugArrayDisplay($aArray, $sFileSelectFolder, "1:")
EndFunc   ;==>Example

* Select a folder (let's choose E:\ in this test)
* The folder content, sorted, will be displayed in a DebugArrayDisplay window, files at the beginning, folders at the end ( folders last character will be a \ )
* Select the files/folders you want (same selecting keys as Windows Explorer) then press the button "Copy Data Only"

Select-in-Debug-Array-Display.png

* All your selection is in the Clipboard now :

E:\blank.htm
E:\home.htm
E:\Ghost\
E:\Temp\

Hope it helps :)
Link to comment
Share on other sites

  • Moderators

AIG,

Take a look at my ChooseFileFolder UDF (the link is in my sig) - that should allow you to do what you want.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png 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 columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

On 4/25/2023 at 6:17 AM, pixelsearch said:

I don't think there's a native function to do this in AutoIt

I've been looking for a feature like this for some time now, but haven't been able to find it. I am very surprised that it does not exist, and I hope that the AutoIt developers will consider adding such a feature.

 

 

On 4/25/2023 at 6:17 AM, pixelsearch said:

Hope it helps :)

Thanks for the suggested solution, and it might just work. Especially if try combining your proposed solution of copying files to the clipboard with this implementation of Windows Explorer right pane

 

 

On 4/25/2023 at 10:57 AM, Melba23 said:

Take a look at my ChooseFileFolder UDF

I checked out your function. It's a very flexible and versatile tool, and it works almost as I need it to.
However, TreeView style does have some usability drawbacks. Your function is definitely praiseworthy, but I couldn't find an option to select files using "Ctrl" and "Shift" keys, which would be much more convenient when dealing with a large number of files in a folder. 

In such situations, the standard file dialog window is better in terms of functionality. 
Mouse-Shift-or-Ctrl.png

Another advantage of the standard file dialog window is its folder navigation (address bar, left-side folder tree, right-side folder pane) and the ability to work with files directly from the file dialog window. Plus, the ability to select files by mouse cursor highlighting is a bonus.

However, currently, your solution remains the most acceptable and functional. I hope that the AutoIt developers will eventually add such a feature or optionally expand the existing function.

Edited by AIG
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...