Hi, my feeling is, there is much wrong with this script. Below, I've just provided some of the very first impressions reading your ChatGPT generated script from top to bottom, ignoring much else which looks incorrect.
This does not appear to be JSL:
Choice Box();
I suspect you want to replace this with something like:
Col List Box();
In your "choice list", the scripts for the two button boxes were not working, perhaps even preventing the creation of the window. If this part of the script is modified like shown below, this will create a window with the buttons working as I think you wanted them to work.
// Create a new choice list
cl = New Window("Column Selection",
H List Box(
Col List Box(
all,
width( 250 ), maxSelected( 1 )
),
Button Box("OK",
cl <<Close Window // use reference to window in button script
),
Button Box("Cancel",
cl <<Close Window // same here
)
)
);
Wait for user input for one second? I am not sure if this makes sense and is at all required.
// Wait for user input
Wait(1); // what is the use of this?
"cl" is a reference to the window created, but you (or ChatGPT) are using it as if it was a table reference.
// Get the selected column name
selectedColumn = cl[1] << Get Selected; // cl is not a table reference
// Close the window
Close(cl, NoSave); // cl is not a table reference
Not a very experienced scripter, but in the one instance were I have tasked ChatGPT with writing a JSL code snippet, it did not work, even though it was only a very simple task. At one point it even "forgot" that the topic of our conversation was JSL, which it seemingly confused with something else abbreviated with JSL. One reference that helped me a lot getting started with scripting is Jump into JMP scripting. You also want to check the JMP Scripting Guide and Scripting Index.