Jump to content

Multiple File Selection with FileOpenDialog


Recommended Posts

Let say a user choose multiple file with FileOpenDialog. How to code to process these chosen files with While or For to do looping?

$var = FileOpenDialog($message, @WindowsDir & "\", "Text (*.txt)", 1 + 4 )

I understand the $var will contain foldername and list of selected files separated with |

How to code this logic in autoit:

for first-file until last-file

blblbla

endfor

or

while

read first file

read second file

until there is no more chosen file

Thanks a lot!! :idea:

Michael.

Link to comment
Share on other sites

Here's a modified help file example

; Multiple filter group
$message = "Hold down Ctrl or Shift to choose multiple files."

$var = FileOpenDialog($message, @WindowsDir & "", "Images (*.jpg;*.bmp)|Videos (*.avi;*.mpg)", 1 + 4 )

If @error Then
    MsgBox(4096,"","No File(s) chosen")
Else
    $var = StringSplit($var, "|")
    For $i = 2 To $var[0]
        MsgBox(4096,"","You chose " & $var[$i])
    Next
EndIf

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

Wow, this is exactly what I need to know. Many thanks Bruce, you're the man :idea:)

Here's a modified help file example

; Multiple filter group
$message = "Hold down Ctrl or Shift to choose multiple files."

$var = FileOpenDialog($message, @WindowsDir & "", "Images (*.jpg;*.bmp)|Videos (*.avi;*.mpg)", 1 + 4 )

If @error Then
    MsgBox(4096,"","No File(s) chosen")
Else
    $var = StringSplit($var, "|")
    For $i = 2 To $var[0]
        MsgBox(4096,"","You chose " & $var[$i])
    Next
EndIf

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...