你好,我正在尝试修改我的代码,以便用户可以选择保存结果 PNG 文件的文件路径以及命名 PNG 文件。该代码是一个子脚本,将由主脚本调用。我的问题是,在我选择路径并命名 PNG 文件后,我收到“不是名称”错误,PNG 文件将保存到我选择的路径,但命名不会通过。我该如何解决这个问题?
谢谢!
MyGraph = Function({yCol},
{default local},
vars = Eval Expr(Variables(
X(:Test Stage),
Group X(:Lot)
));
pts = Expr(Box Plot(X));
For(j = 1, j <= Min(8, N Items(yCol)), j++,
Insert Into(vars, Eval Expr(Y(Expr(yCol[j]), Position(1))));
);
gb = Expr(
Graph Builder(
Size(1255, 981),
Show Control Panel(0),
Elements(Box Plot(X, Y(1), Y(2), Y(3), Y(4), Y(5), Y(6), Y(7), Y(8))),
Local Data Filter(
Add Filter(
columns(:Test Stage, :Sublot, :Temperature, :Soft Bin, :Serial Id),
Display(:Test Stage, N Items(4)),
Display(:Soft Bin, N Items(15))
)
)
)
);
Insert Into(gb, Name Expr(vars));
// Prompt the user to select a directory to save the PNG
dir_path = Pick Directory("Select Directory to Save PNG");
// Check if the user selected a directory
If(Is Empty(dir_path) == 0,
// Ask for the file name using New Window
nw = New Window("Save File", <<MODAL></MODAL>您是否已验证 file_name 包含您认为的内容?您很可能希望使用 << 返回结果,或者在按下 OK 时使用 << 获取文本从文本编辑框中获取值。