Hi,
I am wondering how to request and accept input from an user in package. For example, I want to write a package that requires the user to specify the path to a given file or directory. In Summary I'd like to:
- Have the user specify the file through an Input Field
- Import that file
- Do something with that file
Thus far I've tried:
BeginPackage["Analysis`"]
getFile::usage= "getFile[] imports the user specified file."
Begin["`Private`"]
getFile[___]:=getFile=InputField["Enter the data directory"];
End[];
EndPackage[];
But this does not work as expected. When I call the package in a notebook and call the function getFile[] the dialog box gets created as an output cell instead of an input cell. What is a better and more robust method to request user input and assign that input to variables via a package?
Thanks for your help