I have problems making
Button evaluate an input like this one:
I have tried a bunch of things, but haven't found any elegant solution. What to do?
I think the answer is that the main link has to evaluate the
Get call. Reusing Mr.Wizards test:
Export["testfile.m", "Print[2+2]; f[x_]:=Sin[x]", "String"] Button["Load", Get["testfile.m"], Method -> "Queued"]
works for me. For an explanation what I mean with main link you could check the chat log. I don't know whether it is good practice to include links of this here.
One can see that the
Get operation does work, but simple output is suppressed:
Export["testfile.m", "Print[2+2]; Sin", "String"] Button["Load", << "testfile.m"]
When the button is clicked
4 is printed, but
Sin is not.
This is the same as:
Button["Go", Sin] which also does not print when the button is clicked.
Get is used directly:
At the moment I cannot recall how to get the plain output printed to the evaluation Notebook.
EDIT: It appears there is no simple way: