> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# サンプルスクリプト

> ABBYY Scanning Station 向けのサンプル スクリプト。自動スキャンとエクスポートを行うステーション、JScript による完全なエクスポート ルーチン、C# による登録データ入力ウィンドウを紹介します。

<Accordion title="自動ステーション">
  自動ステーションは画像をスキャンし、生成されたバッチをエクスポートして終了します。

  ```
  [JScript]
  Scan();
  var batch = Batches( Batches.Count - 1 );
  Send( batch );
  while( !batch.IsExported ) {
      Wait( 100 );
  }
  Exit();
  ```
</Accordion>

<Accordion title="フル機能のエクスポート">
  ```
  [JScript]
  var fso = new ActiveXObject("Scripting.FileSystemObject");
  if( ResultPath == "" ) {
      ResultPath = "C:\\Export";
  }
  if( !fso.FolderExists( ResultPath ) ) {
      fso.CreateFolder( ResultPath );
  }
  var params = NewImageSavingOptions();
  params.AddProperFileExt = true;
  params.Format = "bmp";
  var exportedPageCount = CalcExportedPageCount();
  NotifyProcessingProgress( exportedPageCount , PageCount - exportedPageCount );
  for( i = 0; i < Children.Count; i++ ) {
      var item = Children.Item( i );
      if( item.IsDocument ) {
        if( !item.IsExported ) {
          var docDir = ResultPath + "\\" + item.Name;
          if( !fso.FolderExists( docDir ) ) {
            fso.CreateFolder( docDir );
          }
          for( j = 0; j < item .Children.Count; j++ ) {
            CheckCanceled();
            var page = item.Children.Item( j );
            if( !page.IsExported ) {
              page.SaveAs( docDir + "\\" + page.Name, params );
              exportedPageCount++;
              NotifyProcessingProgress( exportedPageCount , PageCount - exportedPageCount );
              page.IsExported = true;
            }
          }
          item.IsExported = true;
        }
      } else {
        CheckCanceled();
        if( !item.IsExported ) {
          item.SaveAs( ResultPath + "\\" + item.Name, params );
          exportedPageCount++;
          NotifyProcessingProgress( exportedPageCount, PageCount - exportedPageCount );
          item.IsExported = true;
        }
      }
  }
  ```
</Accordion>

<Accordion title="登録データ入力用ウィンドウの作成">
  以下の手順は C# 向けです。

  1. 次の[外部アセンブリ](/ja/flexi-capture/scanning-station/shared/scripts/user-assembly-ss)を追加します。
     1. 標準アセンブリ名: *System.Drawing*
     2. 標準アセンブリ名: *System.Windows.Forms*

  2. **%PUBLIC%\ABBYY \ABBYY FineReader Server 14.0\Samples\Script** で利用できる ScanStation.InputComboBox.cs スクリプトを使用します。
</Accordion>
