User Tools

Site Tools


scripting

This is an old revision of the document!


Scripting

To meet user-specified tasks, mAirList is offering a powerful scripting engine which provides extended control functions. With it, users may write their own programmes and extend mAirList’s functionalities significantly.

The code resembles a subset of the Delphi/TurboPascal language, for which a comprehensive and well-structured reference can be found under delphibasics.co.uk. mAirList-specific functions and procedures are to be found – formatted as Windows help file – here.

Note: The full set of functions and procedures is featured only in the latest version of mAirList. Therefore, unaltered scripts originating from well-aged portions of the mAirList Support Forum may be prone to cause issues.

Script Types

Scripts can be established in two different ways: Either as a standalone or as a background script.

Standalone Scripts

Standalone scripts resemble a full delphi programme to be run by external action, such as the menu item mAirList > Run Script… or the remote control command RUNSCRIPT <file>.

Background Scripts

For particular events within the mAirList programme, i. e. when a player is started or some marker is passed whilst playback, mAirList is calling an associated procedure by default. If no background script is available, no further action is taken. However, if a background script exists, the code therein will be executed on the said event.

Furthermore, certain procedures provide parameters related to the regarded event – such as the procedure OnPlayerStart yields information about the assigned player, the item being played and its position whithin the playlist.

An overview of the provided background script procedures is supplied with each version of mAirList within the file Background Script Template.mls.

Creating Code

The code can simply be typed into a text editor. Windows-supplied notepad.exe does the trick flawlessly, however, for major projects the use of some dedicated code editor, like Notepad++ might be considered. The finished code is to be saved in UTF-8 format into a file with the extension .mls.

The structure of a simple Delphi/Turbopascal programme is as follows:

const
  // Constant declarations
 
VAR
  // Variable declarations
 
(* Subprogramme definitions *)
 
procedure DoSomething;
begin
  // Executable statements
end;
 
(* Main programme *)
 
begin
  // Executable statements
end.

Note the different use of semicolon ( ; ) and period ( . ) in subprogramme and main programme respectively.

scripting.1594371531.txt.gz · Last modified: 2020/07/10 08:58 by tondose

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki