執行腳本時出錯 - 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 其餘部分所需的表格