> ## 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# による登録データ入力ウィンドウを紹介します。

<div id="automatic-station">
  ## 自動ステーション
</div>

自動ステーションは画像をスキャンし、生成されたバッチをエクスポートして終了します。このサンプルは JScript で記述されています。

```javascript theme={null}
Scan();
var batch = Batches( Batches.Count - 1 );
Send( batch );
while( !batch.IsExported ) {
    Wait( 100 );
}
Exit();
```

<div id="full-export-routine">
  ## 完全なエクスポート ルーチン
</div>

このサンプルは JScript で記述されています。

```javascript theme={null}
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;
      }
    }
}
```

<div id="registration-data-entry-window">
  ## 登録データ入力ウィンドウ
</div>

以下の手順は C# 用です。

<Steps>
  <Step title="外部アセンブリを追加">
    次の[外部アセンブリ](/ja/flexi-capture/scanning-station/shared/scripts/user-assembly-ss)を、標準アセンブリ名としてそれぞれ追加します: `System.Drawing` と `System.Windows.Forms`。
  </Step>

  <Step title="サンプル スクリプトを使用">
    `%PUBLIC%\ABBYY\ABBYY FineReader Server 14.0\Samples\Script` にある `ScanStation.InputComboBox.cs` スクリプトを使用します。
  </Step>
</Steps>
