运行脚本时出错 - Send 在访问或评估 'Send' 时需要可编写脚本的对象,dt << /*###*/get 列名称( string, Continuous ) /*###*/我修改了一位贡献者之前共享的脚本(谢谢),以便用户可以选择要打开的数据文件(.jmp)文件:
Names Default To Here( 1 );
// Open a dialog to choose a .jmp file to open
// Get the filename of the .jmp file to open
dt = Pick File("Select a .jmp file to open", "", {"JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, "");
// If the user did not select a file, exit the script
If( Is Missing( dt ),
Throw(),
// Else Open the selected file
Open( dt )
);
// Get all of the numeric column's names
colNameList = dt << get column names( string, continuous );
// Take the data from rows 1 & 2 and create the Spec Limits column property
For Each( {col}, colNameList,
Eval(
Substitute(
Expr(
Column( dt, col ) << set property(
"Spec Limits",
{LSL( _LSL_ ), USL( _USL_ ), Show Limits( 1 )}
)
),
Expr( _LSL_ ), As Column( dt, col )[1],
Expr( _USL_ ), As Column( dt, col )[2]
)
)
);
// Exclude and Hide row 1 & 2 to eliminate them from Distributions
dt << Select rows( {1,2} );
dt << hide and exclude;
// Run the Distribution Platform
dt << Distribution( column( eval(colNameList) ));运行脚本时,我遇到了以下错误:
Send 在访问或评估 'Send' 时期望可编写脚本的对象,dt << /*###*/获取列名(字符串,连续)/*###*/
dt << 获取列名称似乎有问题?
我还附上了我想要处理的数据文件的副本。第一行和第二行数据分别是 LSL 和 USL,我不想将其包含在数据中。相反,它们用于在分布图中绘制 LSL 和 USL 线。
感谢社区的任何帮助。谢谢你!
自动化和脚本编写回复:运行脚本时出错 - 在访问或评估 'Send' 时发送需要可编写脚本的对象,dt << /*###*/get 列名称( string, Continuous ) /*###*/嗨吉姆,
非常感谢您引导我完成这段旅程!
回复:运行脚本时出错 - 在访问或评估 'Send' 时发送需要可编写脚本的对象,dt << /*###*/get 列名称( string, Continuous ) /*###*/是的,需要做的就是循环输出并调整每个轴。见下文
names default to here(1);
// Get the filename of the .jmp file to open
dt = Pick File("Select a .jmp file to open", "", {"JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, "");
// If the user did not select a file, exit the script
If( Is Missing( dt ),
Throw(),
// Else Open the selected file
dt = Open( dt )
);
// Get all of the numeric column's names
colNameList = dt << get column names( string, continuous );
// Take the data from rows 1 & 2 and create the Spec Limits column property
For Each( {col}, colNameList,
Eval(
Substitute(
Expr(
Column( dt, col ) << set property(
"Spec Limits",
{LSL( _LSL_ ), USL( _USL_ ), Show Limits( 1 )}
)
),
Expr( _LSL_ ), As Column( dt, col )[1],
Expr( _USL_ ), As Column( dt, col )[2]
)
)
);
// Exclude and Hide row 1 & 2 to eliminate them from Distributions
dt << Select rows( {1,2} );
dt << hide and exclude(1);
// Run the Distribution Platform
dist = dt << Distribution( column( eval(colNameList) ));
// Loop across the output and addjust the axes
rdist = dist << report;
For Each( {col, i}, colNameList,
offset = (Column( col )[2] - Column( col )[1]) * .1;
myMin = Column( col )[1] - offset;
myMax = Column( col )[2] + offset;
// Adjust Min and Max Y-axis
rdist[axis box( i )] << Min( myMin ) << Max( myMax );
);回复:运行脚本时出错 - 在访问或评估 'Send' 时发送需要可编写脚本的对象,dt << /*###*/get 列名称( string, Continuous ) /*###*/看来我需要某种循环,以便将轴设置应用于所有分布图?
回复:运行脚本时出错 - 在访问或评估 'Send' 时发送需要可编写脚本的对象,dt << /*###*/get 列名称( string, Continuous ) /*###*/通过将脚本更改为以下内容,取得了一些小进步:
// Get the filename of the .jmp file to open
dt = Pick File("Select a .jmp file to open", "", {"JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, "");
// If the user did not select a file, exit the script
If( Is Missing( dt ),
Throw(),
// Else Open the selected file
dt = Open( dt )
);
// Get all of the numeric column's names
colNameList = dt << get column names( string, continuous );
// Take the data from rows 1 & 2 and create the Spec Limits column property
For Each( {col}, colNameList,
Eval(
Substitute(
Expr(
Column( dt, col ) << set property(
"Spec Limits",
{LSL( _LSL_ ), USL( _USL_ ), Show Limits( 1 )}
)
),
Expr( _LSL_ ), As Column( dt, col )[1],
Expr( _USL_ ), As Column( dt, col )[2]
)
)
);
// Exclude and Hide row 1 & 2 to eliminate them from Distributions
dt << Select rows( {1,2} );
dt << hide and exclude;
// Adjust Min and Max Y-axis
//dist = dt << Set Axis(
// Min( -10 ),
// Max( 10 )
//);
// Run the Distribution Platform
dist = dt << Distribution( column( eval(colNameList) ));
// Adjust Min and Max Y-axis
rdist = dist << report;
axisbox = rdist[axis box( 1 )];
axisbox << Min( 0 );通过更改,我设法将第一个分布图的最小值更改为“0”,但其余更改保持不变。我可以知道应该如何更改代码,以便最小设置可以应用于所有图表吗?
回复:运行脚本时出错 - 在访问或评估 'Send' 时发送需要可编写脚本的对象,dt << /*###*/get 列名称( string, Continuous ) /*###*/设置轴最大值的语法不是
dist = dt << Set Axis(
Min( -10 ),
Max( 10 )
);
用于更改 AxisBox() 设置的脚本索引如下所示

JSL 示例显示了要使用的正确语法
Names Default To Here( 1 );
Open( "$SAMPLE_DATA/Big Class.jmp" );
biv = Bivariate( Y( :weight ), X( :height ), FitLine );
rbiv = biv << report;
axisbox = rbiv[axis box( 1 )];
axisbox << Max( 120 );
以下是对示例语法的轻微修改,其中轴的设置用于直方图,类似于您在脚本中表示要使用的内容。
// Run the Distribution Platform
Names Default To Here( 1 );
dt = Open( "$SAMPLE_DATA/Big Class.jmp" );
dist = dt << Distribution( column( :weight ));
rdist = dist << report;
axisbox = rdist[axis box( 1 )];
axisbox << Max( 200 ) << Min( 50 );
您可以在脚本指南的显示树部分中了解有关显示输出操作的更多信息。
回复:运行脚本时出错 - 在访问或评估 'Send' 时发送需要可编写脚本的对象,dt << /*###*/get 列名称( string, Continuous ) /*###*/我添加了以下几行来查看是否可以让分布图更改其 Y 轴的最大值和最小值:
// Adjust Min and Max Y-axis
dist = dt << Set Axis(
Min( -10 ),
Max( 10 )
);
好像没有什么效果。我做错了吗?
完整的脚本:
// Get the filename of the .jmp file to open
dt = Pick File("Select a .jmp file to open", "", {"JMP Files|jmp;jsl;jrn", "All Files|*"}, 1, 0, "");
// If the user did not select a file, exit the script
If( Is Missing( dt ),
Throw(),
// Else Open the selected file
dt = Open( dt )
);
// Get all of the numeric column's names
colNameList = dt << get column names( string, continuous );
// Take the data from rows 1 & 2 and create the Spec Limits column property
For Each( {col}, colNameList,
Eval(
Substitute(
Expr(
Column( dt, col ) << set property(
"Spec Limits",
{LSL( _LSL_ ), USL( _USL_ ), Show Limits( 1 )}
)
),
Expr( _LSL_ ), As Column( dt, col )[1],
Expr( _USL_ ), As Column( dt, col )[2]
)
)
);
// Exclude and Hide row 1 & 2 to eliminate them from Distributions
dt << Select rows( {1,2} );
dt << hide and exclude;
// Adjust Min and Max Y-axis
dist = dt << Set Axis(
Min( -10 ),
Max( 10 )
);
// Run the Distribution Platform
dist = dt << Distribution( column( eval(colNameList) ));回复:运行脚本时出错 - 在访问或评估 'Send' 时发送需要可编写脚本的对象,dt << /*###*/get 列名称( string, Continuous ) /*###*/这很容易做到。查看脚本索引并查看可用于 AxisBox 对象的消息。您可以设置最小值和最大值。索引中有一些示例说明了 JSL。
回复:运行脚本时出错 - 在访问或评估 'Send' 时发送需要可编写脚本的对象,dt << /*###*/get 列名称( string, Continuous ) /*###*/我听到您说,一旦我们在脚本中放入 Show( ) 函数,JMP 将调整轴的最大值和最小值,以考虑所有数据点以及 LSL 和 USL。
但是如果我想通过脚本手动定义 Max 和 Min(使用我之前提到的公式),是否可行?
回复:运行脚本时出错 - 在访问或评估 'Send' 时发送需要可编写脚本的对象,dt << /*###*/get 列名称( string, Continuous ) /*###*/设置规格限列属性并指定 Show(1) 元素后,默认情况下,JMP 将更改每个图形的轴值,以包括所有数据点和所有指定的规格限

回复:运行脚本时出错 - 在访问或评估 'Send' 时发送需要可编写脚本的对象,dt << /*###*/get 列名称( string, Continuous ) /*###*/感谢您的清晰解释。当您说 dt 最初采用路径名称和文件名时,我明白您的意思,然后当我尝试获取列名称时,它会变得无法使用。因此我应该执行:
dt = Open( dt )
以便数据表加载来自文件的适当数据以进行正确处理。
我还想问一下,我是否希望脚本调整每个图表 Y 轴的单独最大值和最小值,我该怎么做?
我想找到 USL 和 LSL 之间的绝对范围,然后将 Max Y 设置为 USL + 0.1*range,将 Min Y 设置为 LSL-0.1*range。其想法是对分布图进行一致的表示。
回复:运行脚本时出错 - 在访问或评估 'Send' 时发送需要可编写脚本的对象,dt << /*###*/get 列名称( string, Continuous ) /*###*/变量“dt”是问题所在。您在 Pick File() 中使用它作为选择的结果。因此,它将具有您要打开的文件的路径和名称的值,例如
“C:\Documents\myfile.jmp”
这非常适合您的 Open() 函数,
Open( dt )
因为 Open() 函数需要具有路径和文件名。
但是,打开数据表后,以“dt”作为消息的对象,获取列名()
colNameList = dt << get column names( string, continuous );
getcolumnnames() 消息需要应用于数据表,而不是路径和文件名。
如果您将 Open() 函数调用更改为
dt = Open( dt )
该变量将被更改以采用该值
数据表(“数据表名称”)
这将是您的 JSL 其余部分所需的表格