Click or drag to resize

Structure of a script

Structure of a script in Fast video cataloger

Structure of a script

Open the console window.

The upper part of the console script window contains a script. The lower part of the windows leaves space for output from scripts. The console window has a load button to load script files. For now, we will write the script straight into the window. There is a help button to open the script API documentation. A text field is used to give input to the script, and a run button is used to run the script. By default, the script window has a simple sample script loaded. Let's start with this sample script and remove everything between the {} right at the comment "Enter script here…". After your edits, the script window should have the following text:

C#
using System.Runtime;
using System.Collections.Generic;
using VideoCataloger;
using VideoCataloger.RemoteCatalogService;

class Script
{
  static public async System.Threading.Tasks.Task Run ( IScripting scripting, string arguments ) 
  { 
    // Enter script here...
  }
}

The above is a bare minimal FVC C# script that runs without errors but does nothing.
The using lines at the top tell the script what namespaces you want access to.
Next, the script needs to be inside of a class like this:

C#
class Script
{
}

Inside the class definition, the script must always have a static function named Run that looks like the sample below. The Run function is the entry point of the script and where execution always starts when you click the run button:

C#
static public async System.Threading.Tasks.Task Run ( IScripting scripting, string arguments ) 

In the arguments to the script, IScripting is the root interface. The IScripting interface is how you communicate with the Fast video cataloger program from your script.

The second argument is a string containing whatever is in the text box in the console window.

These components are always the same for all scripts.