# Calling functions which take their arguments interactively

Lets say I have a file named test.m containing some functions.

test[arg1_, arg2_] := (
Print[arg1];
Print[arg2];
)
test3[arg1_, arg2_] := (
Print[arg1];
Print[arg2];
)


What would be a good way to generate a list of butons that would allow you to invoke the functions easily? For example.

The tricky part here (and is mainly why I am asking this question) is calling the functions, which will have several different argument types? I had thought about using an InputField with a MessageDialog, but I would bet there is better way to incorporate Mathematica's features.

ClearAll[loadFile];
, InputForm, HoldComplete], Null];
x = ReleaseHold[
HoldPattern[sym_[args__] := eval_] :>
Button[sym, eval]
];
x[[0]] = List;
x

-

The following code allows you to click the button which will allow you call the function. (functionality still buggy, 2 options 1) add functions to Global namespace 2) figure out some way to allow you to call the functions ).

ClearAll[loadFile];
DeleteCases[
HoldComplete], Null];

Cases[
HoldPattern[sym_[args___] := eval_] :>
Button[Defer[sym], CellPrint[Cell[
BoxData@ToBoxes[Defer[sym[args]]]
, "Input", Evaluatable -> True,
CellEvaluationFunction -> Function[ToExpression[#];],
ShowStringCharacters -> True
]];
] /.
HoldPattern[Pattern][a__, _[x___]] :> Placeholder[a _ x] /.
List :> CompoundExpression,
Button[___]
]


-