複数のPDFファイルをデータテーブルにインポートする方法警告:私はスクリプトを初めて使用します
チャレンジ:
- 私は約500のpdfファイルを持っており、それぞれにJMPにインポートして単一のjmpデータテーブルに照合したいデータテーブルが含まれています。
ワークフローと問題:
- 表形式のデータを1つのPDFからインポートして、呼び出したテーブルに追加できるスクリプト(以下を参照)を作成しました。 Final.jmp 。 スクリプトを別のファイルとして、つまりデータテーブル内に保存しませんでした。 各PDFはに追加されますFinal.jmp単一の行として。
- インポートするたびに、を閉じる必要がありますFinal.jmpテーブルを作成し、新しくインポートされたpdfからの余分な行を含む新しい更新された「最終」テーブルで上書きします。
- インポートするたびに、プロセスで作成されているすべての中間テーブルを手動で閉じる必要もあります。 (退屈な)
- 次に、スクリプト内のpdfファイル名を変更し、保存を押して再実行し、さらに別のpdfをインポートします。 そして、サイクルは続きます。
- このプロセスは手動のコピー貼り付けよりも高速ですが、それでも面倒であり、コンピュータサイエンスで一般的な程度に自動化されていないことはほぼ確実です。
質問:
- インポートする新しいPDFを選択するたびに、スクリプトを繰り返し実行して、1つのフォルダー内のすべての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ファイルをデータテーブルにインポートする方法実行する必要があるのは、コードをループして、次々にファイルを読み込み、それをFinalデータテーブルに追加することだけです。以下の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>Re:複数のPDFファイルをデータテーブルにインポートする方法@txnelson 、感謝の気持ちを適切に表現する方法がわかりません。 あなたはとてもとても親切です よろしくお願いします!
Re:複数のPDFファイルをデータテーブルにインポートする方法申し訳ありませんが、何年にもわたる学術研修にもかかわらず、このループを機能させることができないため、さらに多くの質問をして戻る必要があります。 これが私がそれを機能させることを試みたものです:最初に私はすべてのファイルをローカルハードディスクに移動しました、なぜなら私たちは何らかの理由でサーバー上のいくつかのフォルダ名で「()」を使用していて、これが問題を引き起こしているという印象を持っていたからです。 最終的に、引用符を使用してスクリプト内のディレクトリ全体を「引用」しました。これにより、次のエラーメッセージまでスクリプトを実行するように説得されたようです。 それからそれは私に「パスが無効です... '接着剤' ...」について何かを教えてくれました。 私はそれをグーグルで検索しましたが、その問題に対処する方法がわかりません。 エラーメッセージのファイル名は、操作したいディレクトリ内のファイルの1つの名前であることがわかります。 最初はファイル名のハイフンが問題を引き起こしていると思いましたが、それを変更してもエラーが発生します。
以下に貼り付けました:
- 偽のディレクトリ名を持つスクリプトのコピー。 フォルダーの数と括弧を含むフォルダー名を保持しました。
- スクリプトウィンドウからのエラーメッセージ
- デバッグからのエラーメッセージ
また、最終的なデータテーブルにディレクトリとファイル名を含めるにはどうすればよいですか?
事前にどうもありがとうございました! (これが答えるのが簡単すぎると思うなら、私は理解します。)


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ファイルをデータテーブルにインポートする方法私のエラー.......。
Data table( "Final" );
指定する必要があります
New Table( "Final" );