Is there a MultiSelect option for getfilenameforopen?

Is there a MultiSelect option for getfilenameforopen?

Anonymous
Not applicable
1,168 Views
8 Replies
Message 1 of 9

Is there a MultiSelect option for getfilenameforopen?

Anonymous
Not applicable
...and if so, can you provide a syntax example?
0 Likes
1,169 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable
do you mean selecting more than one file at once by code ?
use OpenFileDialog more than one times ?
0 Likes
Message 3 of 9

Anonymous
Not applicable
Yes I mean to select multiple files from a single dialog box. I was hoping to use the one associated with AutoCAD so I could access customized shortcuts from the ACAD file open dialog. The Windows dialog does not have those shortcuts.
0 Likes
Message 4 of 9

Anonymous
Not applicable
This explains how:

http://through-the-interface.typepad.com/through_the_interface/2007/08/using-autocads-.html
0 Likes
Message 5 of 9

Anonymous
Not applicable
Thanks for the reply, but that is windows OpenFileDialog, not GetFileNameForOpen. I am checking to see if it is possible with the internal dialog with AutoCAD.
0 Likes
Message 6 of 9

Anonymous
Not applicable
You're right.

If it's available, It would be under your

PromptOpenFileOptions

My version doesn't support it so I can't check.

HTH

Bill
0 Likes
Message 7 of 9

chiefbraincloud
Collaborator
Collaborator
I do not believe that GetFileNameForOpen will allow multiples, but you can use something like this.

{code}
Public Function CadOpen(ByVal title As String, ByVal defName As String, ByVal ext As String, _
ByVal flags As Autodesk.AutoCAD.Windows.OpenFileDialog.OpenFileDialogFlags) As String()
Dim OpenDia As New Autodesk.AutoCAD.Windows.OpenFileDialog(title, defName, ext, "", flags)
Try
Dim res As Windows.Forms.DialogResult = OpenDia.ShowDialog
If res <> Windows.Forms.DialogResult.OK Then Return Nothing
Dim Filenames() As String = OpenDia.GetFilenames
If Filenames.Length = 0 Then Return Nothing
Return Filenames
Catch ex As Exception
MsgBox(ex.Message, MsgBoxStyle.Information, "Error Getting Filenames")
Return Nothing
End Try
End Function
{code}

Then call it like this:
Dim Filenames() As String = CadOpen("Select Files for Data Extraction:", "", "dwg", _
Autodesk.AutoCAD.Windows.OpenFileDialog.OpenFileDialogFlags.AllowMultiple)

Check to make sure Filenames is not Nothing before using the names.
Dave O.                                                                  Sig-Logos32.png
0 Likes
Message 8 of 9

Anonymous
Not applicable
That's it! Thanks!
0 Likes
Message 9 of 9

chiefbraincloud
Collaborator
Collaborator
BTW,

For the benefit of others who may read this thread, Kean's post that Bill's Link goes to is using the AutoCAD open file dialog, just like my code, not the Windows one. He just had Autodesk.AutoCAD.Windows imported. I didn't notice that until after I posted my version.
Dave O.                                                                  Sig-Logos32.png
0 Likes