여러 PDF 파일을 데이터 테이블로 가져오는 방법경고: 저는 스크립팅이 처음입니다.
도전 :
- 약 500개의 PDF 파일이 있는데 각 파일에는 JMP로 가져와 단일 jmp 데이터 테이블로 조합하려는 데이터 테이블이 포함되어 있습니다.
작업 흐름 및 문제 :
- 나는 하나의 PDF에서 표로 작성된 데이터를 가져와서 내가 호출한 테이블에 추가할 수 있는 스크립트(아래 참조)를 만들었습니다. Final.jmp . 나는 스크립트를 데이터 테이블 내부가 아닌 별도의 파일로 보관했습니다. 각 PDF는 다음에 첨부됩니다. Final.jmp 단일 행으로.
- 각 가져오기 후에는 닫아야 합니다. Final.jmp 테이블을 새로 가져온 PDF의 추가 행이 포함된 새로 업데이트된 "최종" 테이블로 덮어씁니다.
- 각 가져오기 후에는 프로세스에서 생성되는 모든 중간 테이블도 수동으로 닫아야 합니다. (지루한)
- 그런 다음 스크립트에서 PDF 파일 이름을 변경하고 저장을 누른 후 다시 실행하여 또 다른 PDF를 가져옵니다. 그래서 사이클이 계속됩니다.
- 이 프로세스는 수동으로 복사하여 붙여넣는 것보다 빠르지만 여전히 시간이 많이 걸리고 컴퓨터 과학의 일반적인 수준으로 자동화되지 않은 것이 거의 확실합니다.
질문 :
- 가져올 새 PDF를 선택할 때마다 스크립트를 반복적으로 실행하고 한 폴더의 모든 PDF를 가져올 때까지 동일한 테이블에 추가할 수 있습니까?
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" ) )
데이터 접근Re: 여러 PDF 파일을 데이터 테이블로 가져오는 방법내 실수.........
Data table( "Final" );
지정했어야 했는데
New Table( "Final" );
Re: 여러 PDF 파일을 데이터 테이블로 가져오는 방법죄송합니다. 수년간의 학문적 훈련에도 불구하고 이 루프가 작동하도록 할 수 없기 때문에 더 많은 질문을 가지고 돌아왔습니다. 작동시키려고 시도한 방법은 다음과 같습니다. 먼저 모든 파일을 로컬 하드 디스크로 옮겼습니다. 어떤 이유로 서버의 일부 폴더 이름에 "()"를 사용하고 있는데 이로 인해 문제가 발생한다는 인상을 받았기 때문입니다. . 결국 나는 따옴표를 사용하여 스크립트의 전체 디렉토리를 "인용"했는데, 이는 스크립트가 다음 오류 메시지까지 실행되도록 설득하는 것처럼 보였습니다. 그런 다음 "경로가 잘못되었습니다...'접착제' ..."라는 메시지가 표시되었습니다. 구글링을 해봤지만 해당 문제를 어떻게 해결해야 할지 모르겠습니다. 오류 메시지의 파일 이름이 작업하려는 디렉터리에 있는 파일 중 하나의 이름임을 알 수 있습니다. 처음에는 파일 이름의 하이픈이 문제를 일으키는 줄 알았는데, 변경해도 오류가 발생합니다.
아래에 붙여넣었습니다.
- 가짜 디렉토리 이름을 가진 스크립트 사본. 폴더 수와 괄호가 포함된 폴더 이름을 유지했습니다.
- 스크립트 창의 오류 메시지
- 디버깅의 오류 메시지
또한 최종 데이터 테이블에 디렉터리와 파일 이름을 어떻게 포함합니까?
미리 감사드립니다! (답변이 너무 사소하다고 생각하시면 이해하겠습니다.)


Names default to here(1);
// Here is an example where the first thing that is done, is to create
// the list of the files to be processed
// Many different methods can be used to do this, but for this example
// the file names are read in from a directory
theFilesList = Files in directory( "C:\directory1\subdirectory1\subdirectory2\subdirectory3 (nameof aperson)\subdirectory4\subdirectory5\subdirectory6\subdirectory7\subdirectory8\subdirectory9\subdirectory10" );
// Create the Final data table that will have all of the processed files
// concatenated to it
Data Table( "Final" );
// Loop across all of the files and read them in one at a time and add them
// to the Final data table
For( i = 1, i <= N Items( theFilesList ), i++,
Open(
theFilesList[i],
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" ) );
// Concatenate the processed data to the Final data table
Data Table( "Final" ) << Concatenate( Data Table( "3" ), Append to first table( 1 ) );
// Cleanup the environment
Close( Data Table( "1" ), nosave );
Close( Data Table( "2" ), nosave );
Close( Data Table( "3" ), nosave );
);
Re: 여러 PDF 파일을 데이터 테이블로 가져오는 방법@txnelson , 감사의 마음을 어떻게 적절하게 표현해야할지 모르겠습니다. 당신은 매우 친절합니다. 다시 한 번 도움을 주셔서 정말 감사드립니다!
Re: 여러 PDF 파일을 데이터 테이블로 가져오는 방법해야 할 일은 코드를 반복하면서 파일을 하나씩 읽고 최종 데이터 테이블에 추가하는 것뿐입니다.아래 JSL은 이를 수행하는 방법에 대한 좋은 시작을 제공합니다.
Names default to here(1);
// Here is an example where the first thing that is done, is to create
// the list of the files to be processed
// Many different methods can be used to do this, but for this example
// the file names are read in from a directory
theFilesList = Files in directory( <PATH to="" your="" folder="" that="" has="" the="" .pdf="" files=""> );
// Create the Final data table that will have all of the processed files
// concatenated to it
Data Table( "Final" );
// Loop across all of the files and read them in one at a time and add them
// to the Final data table
For( i = 1, i <= N Items( theFilesList ), i++,
Open(
theFilesList[i],
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" ) );
// Concatenate the processed data to the Final data table
Data Table( "Final" ) << Concatenate( Data Table( "3" ), Append to first table( 1 ) );
// Cleanup the environment
Close( Data Table( "1" ), nosave );
Close( Data Table( "2" ), nosave );
Close( Data Table( "3" ), nosave );
);</PATH>