My following script works, but I want to have an option for browsing to the relevant folder and then selecting the relevant file (both pre-existing) adjacent to the file/folder selection fields (last 3) in my model window. Say a button saying "Browse" adjacent to the last three fields. I also need the folder/file paths to be captured in the box once they are selected by the user, replacing the default entries. How to achieve this in JSL?
Names Default to Here (1);
dlg = New Window("Please enter the following", << Modal, <<Return Result,
Border Box(Top(20), Bottom(0), Left(20), Right(20),
V List Box(
tb1=Text Box("Test Stage "),
teb1 = Text Edit Box("CAP", <<Set Width(200)),
teb1<< Set Hint( "CAP or RES or RF" );
tbs17 = Text Box(""),
tb2=Text Box("Duration"),
teb2 = Text Edit Box("April 2023", <<Set Width(200)),
teb2<< Set Hint( "e.g. April 2023, Dec 2024 etc" );
tbs27 = Text Box(""),
tb3= Text Box("Specify path to file or browse to data file (should pre-exist)"),
teb3 = Text Edit Box("$Documents\", <<Set Width(200)),
teb3 << Set Hint ("e.g. /Tech/");
tbs37 = Text Box(""),
tb4= Text Box("Specify path to file or browse to data summary file (should pre-exist)"),
teb4 = Text Edit Box("$Documents\", <<Set Width(200)),
teb4 << Set Hint ("e.g. /Tech/");
tbs47 = Text Box(""),
tb5= Text Box("Report saving directory (should pre-exist)"),
teb5 = Text Edit Box("$Documents\Report\", <<Set Width(200)),
teb5 << Set Hint ("e.g. /Tech/");
tbs57 = Text Box(""),
tb1<< set font style("bold");
tb2<< set font style("bold");
tb3<< set font style("bold");
tb4<< set font style("bold");
tb5<< set font style("bold");
);
);
);
TestSatge = dlg["teb1"]; Duration = dlg["teb2"]; dtPickPath = dlg["teb3"]; dt_SumCap = dlg["teb4"]; RptSavePath = dlg["teb5"];
//Show(TestSatge);Show(Duration); Show (dtPickPath); Show (dt_SumCap); Show (RptSavePath);
If (dlg["Button"]==-1, Throw());In addition, is it possible to have only those files visible in the folders which user browses to, which have the following wild card e.g. CAP* as selected in the TestStage field?
Finally, Is my throw () statement correct? The idea is to stop further execution if the window is close without clicking OK.