你好社区。 我在使用 ChatGPT 的脚本时遇到问题。 我想构建一个脚本,可以在“选择框”中选择特定列并设置规格限制上限和下限也显示为列属性上的图形参考线。 之后,它将打开“Fit Y by X”图表,如下图所示。 请帮忙...@tx尼尔森
// Open a data table or replace "Data Table Name" with the name of your data table
dt = Current Data Table();
// Get the column names from the data table
columnNames = dt << Get Column Names("String");
// Create a new choice list
cl = New Window("Column Selection",
H List Box(
Choice Box(
columnNames,
"Select a Column",
Value(columnNames[1]),
Set Selected
),
Button Box("OK",
<<CLOSE window=""></CLOSE>嗨,我的感觉是,这个脚本有很多错误。 下面,我刚刚提供了从上到下阅读 ChatGPT 生成的脚本时的一些第一印象,忽略了许多其他看起来不正确的内容。
这似乎不是 JSL:
Choice Box();
我怀疑你想用类似的东西替换它:
Col List Box();
在您的“选择列表”中,两个按钮框的脚本不起作用,甚至可能阻止创建窗口。 如果脚本的这一部分被修改如下所示,这将创建一个窗口,其中的按钮按照我认为您希望它们工作的方式工作。
// 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=""></CLOSE>等待用户输入一秒钟? 我不确定这是否有意义并且是否有必要。
// Wait for user input
Wait(1); // what is the use of this?
“cl”是对创建的窗口的引用,但您(或 ChatGPT)将其用作表引用。
// 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
不是一个非常有经验的脚本编写者,但有一次我要求 ChatGPT 编写 JSL 代码片段,但它不起作用,尽管这只是一项非常简单的任务。 有一次,它甚至“忘记”了我们谈话的主题是 JSL,它似乎与其他缩写为 JSL 的东西混淆了。 对我开始编写脚本有很大帮助的参考文献是跳转到 JMP 脚本编写。 您还需要查看 JMP 脚本指南和脚本索引。