Re : Comment écrire un script JSL pour appeler et exécuter d'autres scripts sans ouvrir de fenêtre de script mais en affichant uniquement un bouton d'annulation ?Cela devrait faire ce que vous demandez. Je n'ai pas vérifié que le bouton d'annulation fonctionne, car JMP a exécuté très rapidement tous les scripts du dossier sur mon ordinateur.
/*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;Re : Comment écrire un script JSL pour appeler et exécuter d'autres scripts sans ouvrir de fenêtre de script mais en affichant uniquement un bouton d'annulation ?@Jed_Campbell Merci,
Je ne comprends pas comment votre script (version légèrement modifiée ci-dessous) appelle le script principal dans le chemin.
Dans mon cas, le script principal appelle tous les autres scripts. C'est la fonctionnalité dont j'ai besoin.
De plus, est-il possible de capturer et d'afficher le journal qui s'affiche (en bas) sur mon script principal dans la fenêtre (nw) générée dans votre script. Quoi qu'il en soit, dans mon cas, le script original et le script modifié ci-dessous n'ont pas fonctionné.
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;Qu'est-ce que j'ai raté?
Re : Comment écrire un script JSL pour appeler et exécuter d'autres scripts sans ouvrir de fenêtre de script mais en affichant uniquement un bouton d'annulation ?Ah, je pense que j'ai mal compris votre question initiale. Le script que j'ai fourni affiche à la fois un bouton d'annulation et exécute tous les scripts dans un dossier. Si je comprends bien, vous avez déjà fait le script pour exécuter tous les autres scripts. Dans ce cas, le script de ce fichier devrait ressembler à :
//!
//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();
Vous voudrez être sûr d'insérer wait(0); déclarations dans votre fichier de script principal. Sinon, JMP risque de ne pas autoriser le bouton d'annulation à fonctionner.
Re : Comment écrire un script JSL pour appeler et exécuter d'autres scripts sans ouvrir de fenêtre de script mais en affichant uniquement un bouton d'annulation ?La clé pour que JSL s'exécute automatiquement est d'ajouter ceci à la toute première ligne du script.
// !
Si vous double-cliquez sur le script, il s'exécutera et n'ouvrira pas le fichier de script.
par exemple, collez ceci dans un script vide et enregistrez-le, puis double-cliquez dessus.
//!
Speak("ha, ha, I just ran a script.");Comment écrire un script JSL pour appeler et exécuter d'autres scripts sans ouvrir de fenêtre de script mais en affichant juste un bouton d'annulation ?Je veux écrire un script JSL, par exemple myScript.jsl qui, lorsque vous double-cliquez pour l'ouvrir, ne s'ouvre pas dans la fenêtre de script mais exécute d'autres scripts appelés dans myScript.jsl tout en affichant une fenêtre modale affichant "Script en cours d'exécution" et un bouton Annuler pour arrêter poursuite de l'exécution.
Si cela est possible en JSL, puis-je avoir un exemple ?
Automatisation et scripts