> ## 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.

# Scripts written in .NET languages

> .NET scripting specifics for ABBYY Scanning Station: assembly requirements, ABBYY.ScanStation namespace, using directives, debugging, and pausing scripts.

The following considerations apply to scripts written in .NET languages (C#.NET, JScript.NET, and VisualBasic.NET).

## Assemblies and namespaces

* Compile .NET assemblies with Microsoft .NET Framework 4.0 or later. Specify the .NET Framework version in your Visual Studio project properties. **Note.** For details on using libraries created in .NET Framework 2.0, 3.0, and 3.5, see [ABBYY FlexiCapture compatibility with different versions of the .NET Framework](http://knowledgebase.abbyy.com/article/1884).
* Add external assemblies for use in scripts and global modules. Both standard and compiled user assemblies work, and all their classes are available in scripts and global modules. For more information, see [External assemblies](/flexi-capture/scanning-station/shared/scripts/user-assembly-ss).
* [Scanning Station script objects](/flexi-capture/scanning-station/shared/scripts/objects) reside in the `ScanStationInterop.dll` assembly and belong to the `ABBYY.ScanStation` namespace. This assembly is in the root folder of the Scanning Station.

All ABBYY Scanning Station script objects are accessible by their own names from the `ABBYY.ScanStation` namespace. For example:

```csharp theme={null}
ABBYY.ScanStation.IWorkspaceItem activeBatch = Workspace.ActiveBatch;
```

## Syntax

Access object elements with the `Workspace` and `ExportBatch` keywords.

Write `using` directives at the beginning of the script body, together with comments and empty lines. Use the same syntax as in the programming language (`using` for C#.NET, `Import` for JScript.NET, and `Imports` for VisualBasic.NET). For example:

```csharp theme={null}
using System.Drawing;
Image img = Image.FromFile( @"D:\2.png" );
```

You can use the `using` directive in the script editor if the `using` keyword comes before the first line of executable code. For example:

```csharp theme={null}
using System.IO;
File.Create(@"C:\sample.txt");
```

## Script execution

* In .NET scripts, you call functions from all global modules directly, without the global module name.
* To skip an optional function parameter, pass `System.Type.Missing` instead.
* FlexiCapture objects do not support multithreading.
* To pause a script, use the `Wait` method of the [IWorkspace](/flexi-capture/scanning-station/shared/scripts/workspace) interface. The standard `Thread.Sleep` method is insufficient.

## Debugging

* To debug .NET scripts, use the [System.Diagnostics.Debugger.Break](http://msdn.microsoft.com/en-us/library/system.diagnostics.debugger.break.aspx) method.
* When debugging .NET scripts, you also need a `.pdb` file with debugging information. This file can be very large, so avoid storing it in the project with your scripts. When debugging, specify that the script is compiled with debugging information.
* If you use Microsoft Visual Studio 2010, you can [attach to the process](http://msdn.microsoft.com/en-us/library/vstudio/3s68z0b3\(v=vs.100\).aspx) where the .NET code runs.
