Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
    
Use the second argument of SystemDialogInput, and store the path in some variable. –  Leonid Shifrin Jul 8 '13 at 22:55

1 Answer 1

up vote 3 down vote accepted

You should simple do something like this:

file = SystemDialogInput["FileOpen"]

SystemDialogInput["FileOpen", DirectoryName@file]

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

share|improve this answer
    
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. –  Stefan Jul 8 '13 at 23:16

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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