Warning: I am new to scripting
Challenge:
- I have about 500 pdf files, each containing a data table I want to import to JMP and collate into a single jmp data table.
Work flow & issues:
- I made a script (see below) that allows me to import the tabulated data from one pdf and append it to a table I called Final.jmp. I kept the script as a separate file, i.e. not inside a data table. Each pdf is appended to Final.jmp as a single row.
- After each import, I have to close the Final.jmp table and overwrite it with the new, updated "final" table that contains the extra row from the newly imported pdf.
- After each import I also have to manually close all the intermediate tables being created in the process. (boring)
- Then I change the pdf file name in the script, press save and re-run it to import yet another pdf. And so the cycles continues.
- This process is faster than manual copy pasting, but still laborious and with near certainty not automated to a degree typical for computer science.
Question:
- Is it possible to have a script run repetitively, each time selecting a new pdf for import and append it to the same table until all pdfs in one folder have been imported?
Open(
"C:\example folder\example.pdf",
PDF Tables(
Table(
table name( "1" ),
add rows( page( 1 ), Rect( 2.0419, 0.9776, 3.1993, 1.1726 ) ),
add rows( page( 1 ), Rect( 1.2137, 3.7819, 6.3603, 3.9069 ) ),
add rows( page( 1 ), Rect( 0.8717, 3.9636, 3.0796, 4.0886 ) ),
add rows(
page( 1 ),
Rect( 0.9853, 4.1436, 3.0029, 4.2686 ),
column borders( 0.9853, 2.5416, 3.0029 )
),
add rows( page( 1 ), Rect( 4.581, 4.1436, 7.297, 4.2686 ) ),
add rows(
page( 1 ),
Rect( 0.8883, 4.4136, 4.6374, 4.5386 ),
column borders( 0.8883, 1.9603, 4.6374 )
),
add rows(
page( 1 ),
Rect( 6.0143, 4.6569, 7.2498, 4.7819 ),
column borders( 6.0143, 6.5817, 7.2498 )
),
add rows( page( 1 ), Rect( 0.7556, 4.7979, 7.5908, 8.2654 ) )
)
)
);
Data Table( "1" ) << Stack(
columns( :Column 3, :Column 4, :Column 5, :Column 6 ),
Source Label Column( "Label" ),
Stacked Data Column( "Data" ),
Output table("2")
);
Data Table( "2" ) << Transpose(
columns( :Data ),
Output Table( "3" )
);
Data Table( "Final" ) << Concatenate( Data Table( "3" ) )