Consider the following. When clicking in "Browse" and then choosing a file, the path will remain in the original one and won't change to the one of the file I chose:
nb = EvaluationNotebook[];
DynamicModule[
{path1 = FileNameJoin[{$HomeDirectory, "Desktop", "file.nb"}],
path2 = FileNameJoin[{$$HomeDirectory, "Desktop", "file.nb"}],
path2 = FileNameJoin[{$HomeDirectory, "Desktop", "file.xls"}],
date = "",
res = ""},
CreateDialog[
Column[
{"Path of" Style["Functions", Italic],
Row[{InputField[Dynamic[path1], String, Enabled -> False],
FileNameSetter[Dynamic[path1],
"Open", {"Mathematica Notebook" -> {"*.nb"}}]}],
"Path of" Style["DataInput", Italic],
Row[{InputField[Dynamic[path2], String, Enabled -> False],
FileNameSetter[Dynamic[path2],
"Open", {"Excel files" -> {"*.xls", "*.xlsx"}}]}],
"Date",
InputField[Dynamic[date], String, ImageSize -> 200,
ContinuousAction -> True, Alignment -> Right,
FieldHint -> "DD/MM/YYYY"],
Grid@{{
Button["Proceed", res =
MyFunction[
path1,
path2,
date
], ImageSize -> Automatic,
Enabled ->
Dynamic[StringQ@path1 \[And] StringQ@path2 \[And]
StringQ@date]
],
Button["Cancel", SetOptions[nb, Visible -> True];
DialogReturn[], ImageSize -> Automatic],
ActionMenu[
"?", {"Long text about who made this program code, when,\n\
what is the version number and how to use it..."}]}
}}
],
NotebookEventActions :> {"WindowClose" :> (SetOptions[nb,
Visible -> True])}
]
];
Myfunction
is in the same notebook before the command nb = EvaluationNotebook[];
:
Myfunction[pathFunctions_, pathInput_, date0_]:=
Module[
{string1=pathFunctions,string2=pathInput,AbsoluteDate0},
AbsoluteDate0=AbsoluteTime[{date0, {"Day", "Month", "Year"}}];
{string1,string2,AbsoluteDate0}
]