And SystemDialogInput[] does return the file, not open it. "FileOpen" refers to
the style of the file-picking dialog. Open-style dialogs have different
properties than Save-style dialogs. Open-style dialogs allow you to pick more
than one file and require you to choose existing files. Save-style dialogs warn
you if you've targeted an existing file (which would potentially be
overwritten). And there's some different labeling, too.
As I believe somebody else already mentioned, FileNameSetter[] does this, too.
The difference between SystemDialogInput and FileNameSetter is that
FileNameSetter is intended to be used in a Dynamic interface for keeping a
Dynamic variable up to date (you can think of it as equivalent to the '...'
button you sometimes see next to an input field for setting filenames in some
dialog boxes), while SystemDialogInput requests the filename immediately and
stops execution of your input until the name is returned. SystemDialogInput is
more appropriate for any procedural bit of code.
Sincerely,
John Fultz
jfultz at wolfram.com
User Interface Group
Wolfram Research, Inc.
On Tue, 7 Dec 2010 06:49:47 -0500 (EST), Murray Eisenberg wrote:
> The OP asked, I believe, for return of the file name, _not_ opening a
> file.
>
> On 12/5/2010 9:48 PM, Patrick Scheibe wrote:
>> Hi,
>>
>> what about
>>
>> SystemDialogInput["FileOpen"]
>>
>> ?
>>
>> Cheers
>> Patrick
>>
>> On Sat, 2010-12-04 at 06:13 -0500, leigh pascoe wrote:
>>> Has anybody written a widget to find and return file names. For
>>> example
>>> if I want to import an image or data file into mathematica, or assign
>>> a
>>> file name to a $Variable, it would be very convenient to have a
>>> function
>>> key that launched a windows style widget that permitted searching
>>> through directories (starting with My Computer or C:) and selecting
>>> the
>>> appropriate file. The full path of the selected file would then be
>>> inserted at the cursor.
>>>
>>> That seems such an obvious tool that it must exist already, but I
>>> haven't seen reference to one anywhere. Anybody?
>>>
>>> LP