3
$\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$
  • $\begingroup$ Use the second argument of SystemDialogInput, and store the path in some variable. $\endgroup$ – Leonid Shifrin Jul 8 '13 at 22:55
4
$\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$
  • $\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 '13 at 23:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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