Hi all,
I want to create a dialog box which asks user to select 2 files.
I could use use pick file function but I want to create a dialog box which picks the file in one shot otherwise pick have to run multiple times.
I want dialog similar to shown in image.
Thanks
The Pick File has a "Multiple" option that allows for the selection of multiple files
See:
Help==>Scripting Index==>Pick File
If you want an interface that's like your sketch, here's a start. At the moment you could select the same file to play both roles, but that's probably not what you want.
NamesDefaultToHere(1);
// Get a list of folders and directories
myFiles = FilesInDirectory("$Desktop");
// Only keep .csv files
for(f = NItems(myFiles), f >=1, f--,
thisOne = myFiles[f];
if (!IsFile(thisOne) | !EndsWith(thisOne, ".csv"), RemoveFrom(myFiles, f));
);
if(Nitems(myFiles) < 2, Print("Not enough .CSV files found"); Beep(); Throw());
// Make a user interface
nw =
NewWindow("Pick Two Files",
LineUpBox(NCol(2),
TextBox(" Pick File 1:"),
cb1 = ComboBox(myFiles),
TextBox(" Pick File 2:"),
cb2 = ComboBox(myFiles)
),
ButtonBox("OK", OKscript);
);
// Runs when 'OK' button is pressed
OKscript =
Expr(
nw << closeWindow;
f1 = myFiles[cb1 << get];
f2 = myFiles[cb2 << get];
Print(f1, f2);
);