cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Try the Materials Informatics Toolkit, which is designed to easily handle SMILES data. This and other helpful add-ins are available in the JMP® Marketplace
Choose Language Hide Translation Bar
wongpl
Level II

script for opening txt file

i always need to open report file ( xxx.rpt) which store in text form in text delimitted form.

i can use the jmp to import the file into jmp table, but the process is a bit tedious.

here is what i do,
1) click " Open data table"
2) type in "*.*" in file name to show all file
3) select the report file that i need ( report file ending with .rpt )
4) change the file type to txt
5) select the option of " Data with preview" click open
6) new window pop up, i select these setting, delimited fileds, end of field is comma, file contains column names on line is 29 , data starts on line 30.
7) click "next"
8) click " import"

i need a scrip that can automate this process. i need a scrip to select the file , then click open to import the file.
i have look thru the Jmp scripting guide but fail to write it.
1 ACCEPTED SOLUTION

Accepted Solutions
pmroz
Super User

Re: script for opening txt file

Once you have opened a file, click on the little red triangle next to the word Source in the upper left corner. Select Edit, and copy the code. Then, combine this code with the pick file() function:

Here's an example I worked up where I saved Big Class.jmp as a csv file with the extension .rpt


my_file = pick file({"All files|*"});

my_dataset = open(my_file,
columns(
name = Character,
age = Numeric,
sex = Character,
height = Numeric,
weight = Numeric
),
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Tab, Comma ),
Strip Quotes( 1 ),
Use Apostrophe as Quotation Mark( 0 ),
Scan Whole File( 1 ),
Labels( 1 ),
Column Names Start( 1 ),
Data Starts( 2 ),
Lines To Read( All ),
Year Rule( "10-90" )
)
);

View solution in original post

2 REPLIES 2
pmroz
Super User

Re: script for opening txt file

Once you have opened a file, click on the little red triangle next to the word Source in the upper left corner. Select Edit, and copy the code. Then, combine this code with the pick file() function:

Here's an example I worked up where I saved Big Class.jmp as a csv file with the extension .rpt


my_file = pick file({"All files|*"});

my_dataset = open(my_file,
columns(
name = Character,
age = Numeric,
sex = Character,
height = Numeric,
weight = Numeric
),
Import Settings(
End Of Line( CRLF, CR, LF ),
End Of Field( Tab, Comma ),
Strip Quotes( 1 ),
Use Apostrophe as Quotation Mark( 0 ),
Scan Whole File( 1 ),
Labels( 1 ),
Column Names Start( 1 ),
Data Starts( 2 ),
Lines To Read( All ),
Year Rule( "10-90" )
)
);
wongpl
Level II

Re: script for opening txt file

Thanks you..PM roz, this fix the problem. Excellent