4
$\begingroup$

It seems that every time the start directory of SystemDialogInput is always the same, is it possible to set the start directory to the last used directory?

For example:

SystemDialogInput["FileOpen"]

enter image description here will start from the "Documents" directory, if I change to other directory and select some file, and run the second input dialog

SystemDialogInput["FileOpen"]

it forgets the directory I chose in the first SystemDialogInput and starts from "Documents" directory again. Is it possible to set SystemDialogInput to always remember the last used directory?

$\endgroup$
1
  • $\begingroup$ Use the second argument of SystemDialogInput, and store the path in some variable. $\endgroup$ Jul 8, 2013 at 22:55

1 Answer 1

5
$\begingroup$

You should simple do something like this:

file = SystemDialogInput["FileOpen"]

SystemDialogInput["FileOpen", DirectoryName@file]

and your directory is the last one you've visited.

$\endgroup$
1
  • $\begingroup$ it's interesting. at first i started to write a RegularExpression and failed and then suddenly this nice function reared up...probably to often reinventing the wheel. $\endgroup$
    – Stefan
    Jul 8, 2013 at 23:16

Your Answer

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

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