Ri: Come scrivere uno script JSL per chiamare ed eseguire altri script senza aprire una finestra di script ma mostrando solo un pulsante Annulla?Questo dovrebbe fare quello che stai chiedendo. Non ho verificato che il pulsante Annulla funzioni, poiché JMP ha eseguito molto rapidamente tutti gli script nella cartella sul mio computer.
/*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;Ri: Come scrivere uno script JSL per chiamare ed eseguire altri script senza aprire una finestra di script ma mostrando solo un pulsante Annulla?@Jed_Campbell Grazie,
Non mi è chiaro come il tuo script (versione leggermente modificata di seguito) chiami lo script principale nel percorso.
Nel mio caso lo script principale chiama tutti gli altri script. Questa è la funzionalità di cui ho bisogno.
Inoltre, è possibile acquisire e visualizzare il registro visualizzato (in basso) sul mio script principale nella finestra (nw) generata nel tuo script. In ogni caso, nel mio caso, lo script originale e quello modificato di seguito non hanno funzionato.
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;Cosa mi sono perso?
Ri: Come scrivere uno script JSL per chiamare ed eseguire altri script senza aprire una finestra di script ma mostrando solo un pulsante Annulla?Ah, penso di aver frainteso la tua domanda iniziale. Lo script che ho fornito mostra sia un pulsante di annullamento che l'esecuzione di tutti gli script in una cartella. Se ho capito bene, hai già creato lo script per eseguire tutti gli altri script. In questo caso, lo script per questo file dovrebbe essere simile a:
//!
//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();
Assicurati di inserire wait(0); istruzioni nel file di script principale. In caso contrario, JMP potrebbe non consentire il funzionamento del pulsante Annulla.
Ri: Come scrivere uno script JSL per chiamare ed eseguire altri script senza aprire una finestra di script ma mostrando solo un pulsante Annulla?La chiave per eseguire automaticamente JSL è aggiungerla alla primissima riga dello script.
//!
Se fai doppio clic sullo script, verrà eseguito e non si aprirà il file di script.
ad esempio, incollalo in uno script vuoto e salvalo, quindi fai doppio clic su di esso.
//!
Speak("ha, ha, I just ran a script.");Come scrivere uno script JSL per chiamare ed eseguire altri script senza aprire una finestra di script ma mostrando solo un pulsante Annulla?Voglio scrivere uno script JSL, ad esempio myScript.jsl che, quando si fa doppio clic per aprire, non si apre nella finestra dello script ma esegue altri script chiamati all'interno di myScript.jsl mentre mostra una finestra modale che mostra "Script in esecuzione" e un pulsante Annulla per interrompere ulteriore esecuzione.
Se questo è possibile farlo in JSL, potrei avere un esempio?
Automazione e scripting