
# IServerProcess interface

The `IServerProcess` interface returns information for commands (server processes) in a server installation file;

```csharp
public interface IServerProcess
```

**Namespace:** DXP · **Assembly:** Altium.SDK.Interfaces

## Remarks

the command name (GetOriginalID method)

the long summary the number of parameters if any parameter names if any

The `IServerProcess` interface is an aggregate interface used within the [`IServerRecord`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/IServerRecord.md) interface.

A typical installation file structure is as follows

ClientInsFile 1.0

Server

EditorName = 'AddOn'

EditorExePath = 'AddOn.DLL'

EditorDescription = 'A demonstratory AddOn module'

Version = 'Version 8.1.4.2763'

Date = '24-Dec-2004'

HelpAboutInfo = 'This software is protected by copyright law and international treaties.'

Copyright = 'Copyright © Altium Limited 2004'

Updates = 'ADVPCB'

Command Name = 'CountPads' LongSummary = 'Find how many pads on a PCB document' End

Command Name = 'RunAPCBProcess' LongSummary = 'Invoke a PCB process' End

All the methods in a server available to the user, such as placing a primitive, changing the zoom level and so on are performed by commands which are pre-packaged process launchers. The pre-packaged process launchers bundle together the process that runs when the command is selected, plus any parameters, bitmaps (icons), captions (the name of an item that displays on a resource), descriptions and associated shortcut keys.

When you select a menu item or click on a toolbar button, you are launching a process. Processes are launched by passing the process identifier to the appropriate server and the server then executes the process. Processes are defined and implemented in the Commands unit of a server source code project. The processes are declared in an Installation File (with an INS extension).

Each process has a process identifier. The process identifier is made up of two parts separated by a colon. The first part of the process identifier indicates the server that defines the process, and the second part is the process name.

For example, the process Sch:ZoomIn is provided by Schematic server. When this process is launched, either by selecting a menu item, pressing a hot key or activating a toolbar button (which are all defined as process launchers), it will perform the task of zooming in on the currently active schematic sheet.

When a server is started up for the first time, process methods or commands registered in the [`CommandLauncher`](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/CommandLauncher.md) object within the server modules.

## Example

Report the processes of a server and their parameters.

```csharp
using System.Collections.Generic;
using System.IO;
using DXP;

IClient client = DXP.GlobalVars.Client;
IServerRecord serverRecord = client.GetServerRecord(0);
var report = new List<string>();

string s = "";
int commandCount = serverRecord.GetCommandCount();
for (int j = 0; j < commandCount; j++)
{
    IServerProcess serverProcess = serverRecord.GetCommand(j);
    report.Add(" Process #" + (j + 1) + " Name = " +
        serverProcess.GetOriginalId() + " LongSummary = " + serverProcess.GetLongSummary());
    int parameterCount = serverProcess.GetParameterCount();
    for (int k = 0; k < parameterCount; k++)
        s = s + serverProcess.GetParameter(k) + ", ";
    report.Add(" Parameters = " + s);
}

string reportPath = Path.Combine(Path.GetTempPath(), "ServerProcesses.txt");
File.WriteAllLines(reportPath, report);
IServerDocument reportDocument = client.OpenDocument("Text", reportPath);
if (reportDocument != null)
    client.ShowDocument(reportDocument);
```

## Methods

| Method | Returns | Description |
| --- | --- | --- |
| [GetLongSummary](#getlongsummary) | `string` | The `GetLongSummary` method returns the Long Summary identifier string. |
| [GetOriginalId](#getoriginalid) | `string` | The GetOriginalID method returns the Process Identifier string for the specified server process. |
| [GetParameter](#getparameter) | `string` | Returns the indexed parameter string. |
| [GetParameterCount](#getparametercount) | `int` | The `GetParameterCount` method returns the number of parameters for the current Process Identifier (GetOriginalID). |

### GetLongSummary

The `GetLongSummary` method returns the Long Summary identifier string.

```csharp
string GetLongSummary();
```

**Returns:** `string`

**See also:** [IServerRecord](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/IServerRecord.md)

### GetOriginalId

The GetOriginalID method returns the Process Identifier string for the specified server process.

```csharp
string GetOriginalId();
```

**Returns:** `string`

**See also:** [IClient](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/IClient.md)

### GetParameter

Returns the indexed parameter string. This is to be used in conjunction with the [`GetParameterCount`](#getparametercount) method. A server process can be parametric, and thus can have a number of parameters.

```csharp
string GetParameter(int argIndex);
```

| Parameter | Type | Passing | Description |
| --- | --- | --- | --- |
| `argIndex` | `int` | value | The index of the parameter string. |

**Returns:** `string`

**See also:** [IClient](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/IClient.md), [IServerProcess.GetParameterCount](#getparametercount)

### GetParameterCount

The `GetParameterCount` method returns the number of parameters for the current Process Identifier (GetOriginalID).

```csharp
int GetParameterCount();
```

**Returns:** `int`

This is to be used in conjunction with the [`GetParameter`](#getparameter) method.

**See also:** [IClient](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/IClient.md), [IServerProcess.GetParameter](#getparameter)

## Returned by

[IServerRecord.GetCommand](https://altiumdeveloper.github.io/ad-sdk-docs/reference/dxp/IServerRecord.md#getcommand)
