I am encountering a problem using SystemDialogInput within a Button. The code below shows what I am doing. To test this create a couple of files "myfile.txt" and "myfile2.txt" etc.

DynamicModule[{path = $HomeDirectory},

   path = SystemDialogInput["FileSave", "myfile.txt"];
   BaseStyle -> {"GenericButton", 11, Bold},
   ImageSize -> 120],

1: Press the "Save" button.

2a: Find e.g. "myfile.txt" and click on it;

or (next try)

2b: Type "myfile.txt" in the input field.

3: I then get the warning message asking me if I want to replace. I choose "Replace".

The problem is that the pathway 1->2a->3 seems to work ok, however 1->2b->3 seems to abort (no path returned). In other words when you type the file name of an exisitng file into the input field and try to save nothing happens.

I am using Mma 8.0.4 on OS X 10.6.8. WRI tech support say they cannot reproduce this.

Q1. Can anyone else reproduce this?

Q2. Can anyone suggest possible causes?

For those who post that it works for them can you give your system and version details. Thanks


I must be in need of a break because it does seem that the evaluation timeout is the cause so Method -> "Queued" is needed. Rookie mistake!

Not sure now whether this question even needs to be here. Probably not.

  • $\begingroup$ It works well for me $\endgroup$
    – Rojo
    Jun 20, 2012 at 4:16
  • $\begingroup$ I see the same behaviour. What was throwing me initially was when I type the name and press 'Save' in the next attempt to save a file, without typing it, the path will not be updated either. Only after the second try I get an updated path. $\endgroup$
    – Matariki
    Jun 20, 2012 at 5:33
  • $\begingroup$ @Mike please don't delete. Aside from the fact that it will bump the question #2000, this is the sort of thing other people might encounter. It might be a "rookie mistake" but there are plenty of rookies out there, especially around the interactive interface capabilities in Mathematica. $\endgroup$
    – Verbeia
    Jun 20, 2012 at 22:38
  • $\begingroup$ Mike, this question looks OK to me. $\endgroup$
    – Mr.Wizard
    Jun 21, 2012 at 0:43
  • $\begingroup$ @Mr.Wizard I guess it provides a lesson in looking for the obvious! Not sure what happened with this: The bug was clearly in my brain cells rather than the function. :) $\endgroup$ Jun 21, 2012 at 1:58

1 Answer 1


You have to use the button option Method -> "Queued" to avoid evaluation timeout. Try this code:

DynamicModule[{path = $HomeDirectory}, 
    path = SystemDialogInput["FileSave", "myfile.txt"];
    Print[FullForm@path], Method -> "Queued", 
    BaseStyle -> {"GenericButton", 11, Bold}, ImageSize -> 120], 
  • $\begingroup$ While for some people/tests an evaluation timeout is a possibility, in this case it is not the cause of the problem. For example if I type new file name no such problem exists. The problem is only for existing file names. $\endgroup$ Jun 20, 2012 at 7:00
  • $\begingroup$ Sorry for being unhelpful Mike, it didn't work for me, same behaviour as you described including that it worked with new file names, but now it works every time. $\endgroup$
    – Matariki
    Jun 20, 2012 at 8:24
  • $\begingroup$ @MikeHoneychurch I too thought that this would be the problem. I can reproduce the problem and Method -> "Queued" really makes it go away. $\endgroup$ Jun 20, 2012 at 11:07
  • $\begingroup$ @MikeHoneychurch: if you see that it sometimes works even without Method->"Queued" that's no surprise: it will depend on how fast you are, if you click "OK" within the timeout limit, I would expect the code to work even without the Method option, if you are too slow I would expect it to not work. Can you exclude that that was the reason why it worked for one case but not the other? I absolutely agree that Method->"Queued" should solve your problem, it has always solved exactly the same kind of problems for me... $\endgroup$ Jun 20, 2012 at 12:14
  • $\begingroup$ @SjoerdC.deVries Yes it goes away. I am going crazy?? :) $\endgroup$ Jun 20, 2012 at 22:16

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.