cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Instantly extract effect sizes, F-ratios, and FDR-adjusted p-values from your models with the Calculate Effects Sizes extension, available now in the JMP Marketplace!
  • New to JMP? Join us Sept. 23-24 for the Early User Edition of Discovery Summit, tailor-made for new users. Register now for free!
  • Your voice matters! Tell us how you prefer to receive JMP updates, so we can tailor our communication to your needs. Take short survey.

Discussions

Solve problems, and share tips and tricks with other JMP users.
Choose Language Hide Translation Bar
theo_beluzzi
Level I

Running a script in several files

I need to run the same script in several files. How do I do it without having to change manually the file path each time?

How can i create something like a list of files, and run the script on them all, saving those separately?

thanks!

2 REPLIES 2
pmroz
Super User

Re: Running a script in several files

Something like this might do the trick.  The script myscript.jsl would use the global variable ::g_dataset to process the data in the file.

file_list = {

      "c:\temp\file1.jmp",

      "c:\temp\file2.jmp",

      "c:\temp\file3.jmp",

};

for (i = 1, i <= nitems(file_list), i++,

      ::g_dataset = open(file_list[i]);

      include("c:\scripts\myscript.jsl");

//    close(::g_dataset, nosave);

);

msharp
Super User (Alumni)

Re: Running a script in several files

Just appending to PMroz​'s answer, if you don't want to type out a long file_list, you could always organize your files into a directory then do something like below:

Names Default To Here( 1 );

dir = Pick Directory();

file_list = Files In Directory( dir);

for (i = 1, i <= nitems(file_list), i++,

       if(Is File(file_list[i]),

      ::g_dataset = open(file_list[i]);

      include("c:\scripts\myscript.jsl");

//    close(::g_dataset, nosave);

       )

);

Recommended Articles