2
$\begingroup$

The documentation for SystemDialogInput shows how to restrict the types of files shown.

SystemDialogInput["FileOpen",".nb"]

...only shows Mathematica notebook files. This also works for other file extensions such as ".txt", ".html", etc., but doesn't work for other file types.

If I have a tab delimited file that with extension ".data" and try:

SystemDialogInput["FileOpen",".data"]

...the dialog box defaults to all files.

Is there a way to only show other "non-standard" file types?

$\endgroup$

1 Answer 1

5
$\begingroup$

Try this:

SystemDialogInput["FileOpen", {"Data", {"Data" -> {"*.data", "*.dat"}}}]

The doc page for SystemDialogInput describes under "More Information" how to create new file types by listing the patterns they match.

$\endgroup$
2
  • $\begingroup$ Crap, just figured it out. What purpose does the init argument have in this case? $\endgroup$
    – kale
    Commented Nov 19, 2012 at 19:41
  • $\begingroup$ @kale You can define several allowed file types. init gives the one the dialog is set to when launched. $\endgroup$
    – Szabolcs
    Commented Nov 19, 2012 at 19:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.