エクスポート処理のためのスクリプトの作成

ABBYY FineReader Server 14 により、スクリプトを用いてエクスポート処理を設定できます。 このスクリプトは出力ファイルを処理し、失敗ジョブから生じる画像や XML を処理するために使用できます。

重要事項!エクスポート処理スクリプトは、Server Manager によってトリガされます。 このため、スクリプトが共有リソースで適切に動作する必要があり、リソースへのアクセスに必要な権限を持つユーザーアカウントで処理ステーションを実行する必要があります。.

公開ジョブを正常に処理

スクリプトは、ドキュメントタイプと属性、ジョブのプロパティ、認識の統計に基づいて、出力ドキュメントを適切な保存先に配信できます。 スクリプトは出力フォルダに公開された後、各出力ドキュメントに対して実行できます。

出力ファイルの処理のスクリプトを使用するには、以下を実行してください:

  1. ワークフローのプロパティダイアログボックスの 6. 出力タブで、必要な出力フォーマットを指定し、 スクリプト...ボタンをクリックします。
  2. 表示される スクリプトエディタ ダイアログボックスでは、スクリプト言語を選択し、スクリプトテキストを入力します。 参照の「this」又は「Me」は、PublishedDocument オブジェクトを指しています。
  3. 確認ボタンをクリックし、スクリプトをチェックします。 OKをクリックし、スクリプトを保存します。

失敗ジョブの処理

スクリプトは、ジョブのプロパティ、入力ファイルのプロパティ、エラー説明に基づいて、処理失敗の画像を適切な保存先に転送できます。 スクリプトは、各失敗ジョブに対してトリガされます。

画像や XML 結果の処理のためにスクリプトを使用するには、以下のように実行してください:

  1. ワークフローのプロパティ ダイアログボックスの4. 品質管理 のタブで、例外フォルダを設定し、 スクリプト...をクリックします。
  2. 表示される スクリプトエディタ  ダイアログボックスでは、スクリプト言語を選択し、スクリプトテキストを入力します。 参照の「this」又は「Me」は、FailedJob オブジェクトを指しています。
  3. 確認ボタンをクリックし、スクリプトをチェックします。 OKをクリックし、スクリプトを保存します。

サンプル

var attributeToUse = "";
if( DocumentType == "Article" ) {
   attributeToUse = "Customer Name";
} else if( DocumentType == "Resume" ) {
   attributeToUse = "Applicant's Name";
} else if( DocumentType == "Brochure" ) {
   attributeToUse = "Product Name";
}
if( attributeToUse == "" ) {
   return;
}
var attributeValue = retrieveAttributeValue( attributeToUse );
if( attributeValue == "" ) {
   return;
}
var fso = new ActiveXObject("Scripting.FileSystemObject");
for( i = 0; i < OutputFormats.Count; i++ ) {
   var format = OutputFormats.Item( i );
   var folderPath = format.OutputLocation;
   folderPath = fso.BuildPath( folderPath, JobProperties.Subfolder );
   var outputFiles = format.OutputFiles;
   for( j = 0; j < outputFiles.Count; j++ ) {
      var initialName = outputFiles.Item( j );
      var slashPosition = initialName.lastIndexOf( "\\" );
      LogMessage( "slash position: " + slashPosition );
      if( slashPosition != -1 ) {
         var subPath = initialName.substring( 0, slashPosition );
         LogMessage( "subPath: " + subPath );
      }
      var initialExt = fso.GetExtensionName( initialName );
      var sourcePath = fso.BuildPath( folderPath, initialName );
      var sourceFolder = fso.GetParentFolderName( sourcePath );
      var destPath = fso.BuildPath( sourceFolder, attributeValue + "." + initialExt );
      if( fso.FileExists( destPath ) ) {
          fso.DeleteFile( destPath );
      }
      fso.MoveFile( sourcePath, destPath );
   }
}
function retrieveAttributeValue( name )
{
   for( i = 0; i < Attributes.Count; i++ ) {
      var attribute = Attributes.Item( i );
      if( attribute.Name == name ) {
          return attribute.Value;
      }
   }
}

こちらも参照してください:

ABBYY FineReader Server でのスクリプトの使用

26.03.2024 13:49:51

Please leave your feedback about this article

Usage of Cookies. In order to optimize the website functionality and improve your online experience ABBYY uses cookies. You agree to the usage of cookies when you continue using this site. Further details can be found in our Privacy Notice.