回复:如何編寫一個 JSL 腳本來調用和運行其他腳本而不打開腳本窗口但只顯示一個取消按鈕?這應該做你所要求的。 我還沒有驗證取消按鈕是否有效,因為 JMP 非常快速地運行了我計算機上文件夾中的所有腳本。
/*JMP STATISTICAL DISCOVERY LLC (“JMP”) PERMITS THE USE OF THIS COMPUTER SOFTWARE CODE (“CODE”) ON AN AS-IS BASIS AND AUTHORIZES YOU TO USE THE CODE SUBJECT TO THE TERMS LISTED HEREIN. BY USING THE CODE, YOU AGREE TO THESE TERMS. YOUR USE OF THE CODE IS AT YOUR OWN RISK. JMP MAKES NO REPRESENTATION OR WARRANTY, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NONINFRIGEMENT, AND TITLE, WITH RESPECT TO THE CODE.
You may use the Code solely as part of a software product you currently have licensed from JMP, JMP’s parent company SAS Institute Inc. (“SAS”), or one of JMP’s or SAS’s subsidiaries or authorized agents (the “Software”), and not for any other purpose. The Code is designed to add functionality to the Software but has not necessarily been tested. Accordingly, JMP makes no representation or warranty that the Code will operate error-free. JMP is under no obligation to maintain, support, or continue to distribute the Code.
Neither JMP nor its licensors shall be liable to you or any third-party for any general, special, direct, indirect, consequential, incidental, or other damages whatsoever arising out of or related to your use or inability to use the Code, even if JMP has been advised of the possibility of such damages. Except as otherwise provided above, the Code is governed by the same agreement that governs the Software. If you do not have an existing agreement with JMP or SAS governing the Software, you may not use the Code.
JMP and all other JMP Statistical Discovery LLC product or service names are registered trademarks or trademarks of JMP Statistical Discovery LLC in the USA and other countries. ® indicates USA registration. Other brand and product names are registered trademarks or trademarks of their respective companies.
*/
Names Default To Here( 1 );
//get scripts to run
lstScripts = Files In Directory( "$Documents/My Scripts/" );
//set up stop button
nw = New Window( "Running",
Text Box( "Running all the scripts" ),
Button Box( "Cancel", Stop() )
);
For Each( {i}, lstScripts,
If( Word( -1, i, "." ) == "jsl", //make sure it's a .jsl file
include( "$Documents/My Scripts/" || Char( i ) ); //run it
Wait( 0 ); //this allows JMP to recognize if cancel button has been pressed
)
);
nw << close window;回复:如何編寫一個 JSL 腳本來調用和運行其他腳本而不打開腳本窗口但只顯示一個取消按鈕?@Jed_Campbell謝謝,
我不清楚您的腳本(下面稍作修改的版本)如何調用路徑中的主腳本。
在我的例子中,主腳本調用所有其他腳本。 這是我需要的功能。
此外,是否可以在腳本中生成的窗口 (nw) 中捕獲並顯示顯示在我的主腳本上(底部)的日誌。 就我而言,無論如何,原始腳本和修改後的腳本都不起作用。
Names Default To Here( 1 );
path2Scripts = "C:\Users\UserName\Documents\Scripts_v0.1.4"; //change this as necessary
//get scripts to run
lstScripts = Files In Directory(path2Scripts);
//set up stop button
nw = New Window( "Running", << modal,
Text Box( "Running all the scripts" ),
Button Box( "Cancel", Stop() )
);
For Each( {i}, lstScripts,
If( Word( -1, i, "." ) == "jsl", //make sure it's a .jsl file
include( path2Scripts || Char( i ) ); //run it
Wait( 0 ); //this allows JMP to recognize if cancel button has been pressed
)
);
nw << close window;我錯過了什麼?
回复:如何編寫一個 JSL 腳本來調用和運行其他腳本而不打開腳本窗口但只顯示一個取消按鈕?啊,我想我誤解了你原來的問題。 我提供的腳本既顯示取消按鈕又運行文件夾中的所有腳本。 如果我理解正確的話,您已經編寫了運行所有其他腳本的腳本。 在這種情況下,此文件的腳本應如下所示:
//!
//the //! comment on the first line causes the script to run, rather than open
Names Default To Here (1);
clear log();
//set up stop button
nw = New Window( "Running", << modal,
Text Box( "Running all the scripts" ),
Button Box( "Cancel", Stop() )
);
include("path/to/main/scipt.jsl"); //your file that runs all the scripts
logtxt = get log();
您需要確保插入 wait(0);主腳本文件中的語句。 否則,JMP 可能不允許取消按鈕起作用。
回复:如何編寫一個 JSL 腳本來調用和運行其他腳本而不打開腳本窗口但只顯示一個取消按鈕?使 JSL 自動運行的關鍵是將其添加到腳本的第一行。
//!
如果雙擊腳本,它將運行並且不會打開腳本文件。
例如,在一個空腳本中傳遞它並保存它,然後雙擊它。
//!
Speak("ha, ha, I just ran a script.");如何編寫 JSL 腳本來調用和運行其他腳本而不打開腳本窗口但只顯示取消按鈕?我想編寫一個JSL 腳本,例如myScript.jsl,雙擊打開時它不會在腳本窗口中打開,而是運行在myScript.jsl 內調用的其他腳本,同時顯示一個顯示“腳本運行”的模式窗口和一個用於停止的取消按鈕進一步執行。
如果可以在 JSL 中做到這一點,能給我一個例子嗎?
自動化和腳本編寫