Hi,
Just started learning scripting so please excuse the messy or redundant coding haha. I'm trying to combine a few things I've picked up from these forums. Basically, give the user an option of opening a file or selecting an already open file. I've finally figured out I needed to use a Modal window to wait for the selection is made before continuing down the script.
Is there a way to have the code continue when the selection is made? Instead of waiting for the user to press the "Ok" button? So for my two options:
1. User opens a file --> continue when the file is opened
2. User selects an open file --> continue when the file is selected
Right now, having them press the "ok" button after the selection seems redundant. Thanks for any help!
InputWindow = New Window( "Pick a file opening option (must be truncated)", <<modal,
V List Box(
Text Box( "Pick a Cut and Truncated Waveform" ),
Spacer Box( size( 1, 10 ) ),
Button Box( "Open a file",
path = Pick File(
"Select Raw Waveform data",
"", // no default directory
{"JMP Files|jmp;jsl;jrn", "All Files|*"},
1,
0,
"" // no default file
);
open(path);
dt=current data table();
),
Spacer Box( size( 10, 1 ) ),
Button Box( "Select from a list",
choose_data_table=function({},
list = {};
For( i = 1, i <= N Table(), i++,
list[i] = Data Table( i ) << get name
);
win = New Window( "Select a data table", << Modal,
hb = H List Box(
Panel Box( "Choose a data table",
dt = List Box(
list,
max selected( 1 ),
chosen = Data Table( (dt << get selected)[1] );
show (chosen);
)),)
);
chosen);
dt=choose_data_table();
)
)
)
);