- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
JSL to Select Project Tab and Run Script
Folks,
I'm brand new to working with Projects and am having some difficulty achieving various things that I routinely do in JSL. My Project has 4 data tables and I'm trying to select one of them and then run a particular script that is listed in that data table. I've looked at the help information for Projects but can't quite figure out how to accomplish this. Any suggestions/ideas would be greatly appreciated.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JSL to Select Project Tab and Run Script
Use Project << Run Script() to run JSL inside the project from outside of it:
// 1. Create a project and open two data table in it
p = new Project();
p << Run Script(
Open("$SAMPLE_DATA/Big Class.jmp");
Open("$SAMPLE_DATA/Airline Delays.jmp");
);
// 2. Run the a saved script from each table
p << Run Script(
Get Data Table("Big Class") << Run Script("Distribution");
Get Data Table("Airline Delays") << Run Script("Graph Builder Heatmap");
);
// 3. Optionally, make Big Class the visible tab
wait(0);
p << Run Script(
Get Window("Big Class") << Bring Window To Front();
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JSL to Select Project Tab and Run Script
To clarify, are you wanting to use JSL in projects to do something you usually do with JSL outside of projects, or use the gui interface in projects to do what you normalyly do in JSL?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JSL to Select Project Tab and Run Script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JSL to Select Project Tab and Run Script
Hi Aaron,
I'm trying to use JSL to work with but outside an existing Project. That is, with an open Project I want to run an external script that selects a particular tab and runs a script saved with that tab. For example, with data tables Big Class, Abrasion, and Bicycle Moved to a Project (I tried to send my archiived version of this project but an error says "The contents of the attacment doesn't match its file type"), I want a JSL file that is saved outside the Project to Open the Project, Select Tab Big Class, Run Distribution script, switch to Tab Bicycle and run Fit Model script. I can open the Project without any trouble, but can't accomplish the rest.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JSL to Select Project Tab and Run Script
Use Project << Run Script() to run JSL inside the project from outside of it:
// 1. Create a project and open two data table in it
p = new Project();
p << Run Script(
Open("$SAMPLE_DATA/Big Class.jmp");
Open("$SAMPLE_DATA/Airline Delays.jmp");
);
// 2. Run the a saved script from each table
p << Run Script(
Get Data Table("Big Class") << Run Script("Distribution");
Get Data Table("Airline Delays") << Run Script("Graph Builder Heatmap");
);
// 3. Optionally, make Big Class the visible tab
wait(0);
p << Run Script(
Get Window("Big Class") << Bring Window To Front();
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JSL to Select Project Tab and Run Script
Dang,
That was easy. I wasn't aware that I had to use Run Script for each command or set of commands.
It's now working very well except for being able to pass a variable as the Window or Data Table Name. I'm using JSL to process data from numerous sites and I pull the site id from the opened data file and then use that in many other sections of JSL to save, rename, move the data files to site specific directories. Unfortunately, I can't pass my variable, stn, into the Window or Data Table names as shown below. Is it possible to do this with Projects, and if so, do you have a suggestion for how to accomplish it?
Project << Run Script( Get Data Table( stn || " Amp_Hr Per Day" ) ); << Run Script( "OP of Parameters w/ PAR" );
Project << Run Script ( Get Window( stn || " Amp_Hr Per Day" ) << Bring Window to Front() );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content
Re: JSL to Select Project Tab and Run Script
@terapin wrote:
Dang,
That was easy. I wasn't aware that I had to use Run Script for each command or set of commands.
It's now working very well except for being able to pass a variable as the Window or Data Table Name. I'm using JSL to process data from numerous sites and I pull the site id from the opened data file and then use that in many other sections of JSL to save, rename, move the data files to site specific directories. Unfortunately, I can't pass my variable, stn, into the Window or Data Table names as shown below. Is it possible to do this with Projects, and if so, do you have a suggestion for how to accomplish it?
Project << Run Script( Get Data Table( stn || " Amp_Hr Per Day" ) ); << Run Script( "OP of Parameters w/ PAR" );
Project << Run Script ( Get Window( stn || " Amp_Hr Per Day" ) << Bring Window to Front() );
It's intentional that Projects have their own JSL scopes, but that can cause issues when trying to share variables between them. One way to do that is to use Eval/EvalExpr. It's not pretty, but it does the trick:
win name = "Big Class";
Eval(
Eval Expr(
project << Run Script( Get Window( Expr( win name ) ) << Bring Window To Front() )
)
);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Get Direct Link
- Report Inappropriate Content