您好,我正在嘗試修改我的程式碼,以便用戶可以選擇儲存結果 PNG 檔案的檔案路徑以及命名 PNG 檔案。該程式碼是一個下標,將被主腳本呼叫。我的問題是,在選擇路徑並命名 PNG 檔案後,出現“Not a Name”錯誤,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 是否包含您認為的內容?您很可能想要使用 << 傳回結果,或在按下「確定」時使用 << get text 從文字編輯框中取得值。