Betreff: Wie schreibe ich ein JSL-Skript, um andere Skripte aufzurufen und auszuführen, ohne ein Skriptfenster zu öffnen, sondern nur eine Schaltfläche zum Abbrechen anzuzeigen?Dies sollte tun, was Sie verlangen. Ich habe nicht überprüft, ob die Schaltfläche „Abbrechen“ funktioniert, da JMP alle Skripts im Ordner auf meinem Computer sehr schnell ausgeführt hat.
/*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;Betreff: Wie schreibe ich ein JSL-Skript, um andere Skripte aufzurufen und auszuführen, ohne ein Skriptfenster zu öffnen, sondern nur eine Schaltfläche zum Abbrechen anzuzeigen?@Jed_Campbell Danke,
Mir ist nicht klar, wie Ihr Skript (leicht modifizierte Version unten) das Hauptskript im Pfad aufruft.
In meinem Fall ruft das Hauptskript alle anderen Skripte auf. Das ist die Funktionalität, die ich brauche.
Ist es außerdem möglich, das Protokoll zu erfassen und anzuzeigen, das (unten) in meinem Hauptskript in dem in Ihrem Skript generierten Fenster (nw) angezeigt wird? In meinem Fall funktionierten das ursprüngliche und das unten modifizierte Skript jedenfalls nicht.
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;Was habe ich verpasst?
Betreff: Wie schreibe ich ein JSL-Skript, um andere Skripte aufzurufen und auszuführen, ohne ein Skriptfenster zu öffnen, sondern nur eine Schaltfläche zum Abbrechen anzuzeigen?Ah, ich glaube, ich habe Ihre ursprüngliche Frage falsch verstanden. Das von mir bereitgestellte Skript zeigt sowohl eine Schaltfläche zum Abbrechen an als auch die Ausführung aller Skripte in einem Ordner. Wenn ich das richtig verstehe, haben Sie bereits das Skript erstellt, um alle anderen Skripte auszuführen. In diesem Fall sollte das Skript für diese Datei etwa so aussehen:
//!
//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();
Sie sollten unbedingt wait(0); Anweisungen in Ihrer Hauptskriptdatei. Andernfalls lässt JMP möglicherweise nicht zu, dass die Schaltfläche „Abbrechen“ funktioniert.
Betreff: Wie schreibe ich ein JSL-Skript, um andere Skripte aufzurufen und auszuführen, ohne ein Skriptfenster zu öffnen, sondern nur eine Schaltfläche zum Abbrechen anzuzeigen?Der Schlüssel zur automatischen Ausführung von JSL besteht darin, dies in die allererste Zeile des Skripts einzufügen.
//!
Wenn Sie auf das Skript doppelklicken, wird es ausgeführt und die Skriptdatei wird nicht geöffnet.
Fügen Sie dies beispielsweise in ein leeres Skript ein, speichern Sie es und doppelklicken Sie dann darauf.
//!
Speak("ha, ha, I just ran a script.");Wie schreibe ich ein JSL-Skript, um andere Skripte aufzurufen und auszuführen, ohne ein Skriptfenster zu öffnen, sondern nur eine Schaltfläche zum Abbrechen anzuzeigen?Ich möchte ein JSL-Skript schreiben, beispielsweise myScript.jsl, das sich beim Doppelklicken zum Öffnen nicht selbst im Skriptfenster öffnet, sondern andere in myScript.jsl aufgerufene Skripte ausführt und dabei ein modales Fenster mit der Meldung „Skript wird ausgeführt“ und eine Schaltfläche „Abbrechen“ zum Anhalten anzeigt weitere Ausführung.
Wenn dies in JSL möglich ist, könnte ich bitte ein Beispiel haben?
Automatisierung und Skripterstellung