Jump to content

Fileopendialog open songle or mltiple files


Recommended Posts

A few ways you could tackle this...here's one:

$var = _MyFileOpenDialog()

#region - Just for displaying results
If IsArray($var) Then
    Local $tmp
    For $i = 2 To UBound($var) - 1
        $tmp &= $var[$i] & @LF
    Next
    MsgBox(0, '', $tmp)
Else
    MsgBox(0, '', $var)
EndIf
#endregion

Func _MyFileOpenDialog()
    Local $file, $array
    $file = FileOpenDialog('Select File(s)', @HomeDrive, 'All Files (*.*)', 7)
    If @error Then Return 'No files selected'
    If Not StringInStr($file, '|') Then Return $file
    $array = StringSplit($file, '|')
    If StringRight($array[1], 1) <> '\' Then $array[1] = $array[1] & '\'
    For $i = 2 To $array[0]
        $array[$i] = $array[1] & $array[$i]
    Next
    Return $array
EndFunc
Edited by xcal
Link to comment
Share on other sites

Has anybody coded the ultimate commands after the fileopendialog (option 1+4). The logic after selecting 1 file or multiple files is different.

Thanx.

Thank You, I codes something similair, but your code looks more compact.

At the end I have still a problem. When selected one file i must proces $files, and when selected more files I must process $tmp.

So there is stiil needed some coding like array delete or arrayinsert.

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