# Why is SystemDialogInput failing to return a save file path?

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}, Column[{ Button["Save", path = SystemDialogInput["FileSave", "myfile.txt"]; Print[FullForm@path], BaseStyle -> {"GenericButton", 11, Bold}, ImageSize -> 120], Dynamic[path] }] ]  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 Edit 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. - It works well for me – Rojo Jun 20 '12 at 4:16 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. – Matariki Jun 20 '12 at 5:33 @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. – Verbeia Jun 20 '12 at 22:38 Mike, this question looks OK to me. – Mr.Wizard Jun 21 '12 at 0:43 @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. :) – Mike Honeychurch Jun 21 '12 at 1:58 ## 1 Answer You have to use the button option Method -> "Queued" to avoid evaluation timeout. Try this code: DynamicModule[{path =$HomeDirectory},
Column[{Button["Save",

@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... –  Albert Retey Jun 20 '12 at 12:14