Jump to content
Sign in to follow this  
michaelslamet

Multiple File Selection with FileOpenDialog

Recommended Posts

michaelslamet

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.

Share this post


Link to post
Share on other sites
somdcomputerguy

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.

Share this post


Link to post
Share on other sites
michaelslamet

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

Share this post


Link to post
Share on other sites
somdcomputerguy

You bet, Good luck.


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

Share this post


Link to post
Share on other sites
michaelslamet

Thanks, Bruce :idea: I need to learn alot after years without programming :)

You bet, Good luck.

Share this post


Link to post
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
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.