User Tools

Site Tools


scripting

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
scripting [2020/07/10 09:33] tondosescripting [2020/07/10 10:23] tondose
Line 5: Line 5:
 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 expand mAirList’s functionalities significantly. 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 expand 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 [[http://delphibasics.co.uk/|delphibasics.co.uk]]. mAirList-specific functions and procedures are to be found – formatted as Windows help file – [[https://www.mairlist.com/download/current/mAirList/v6.1/scriptinghelp/mAirListScript.chm|here]].+The code resembles a subset of the //Delphi/TurboPascal// language, for which a comprehensive and well-structured reference can be found under [[http://delphibasics.co.uk/|delphibasics.co.uk]]. mAirList-specific functions and procedures are to be foundformatted as Windows help file[[https://www.mairlist.com/download/current/mAirList/v6.1/scriptinghelp/mAirListScript.chm|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 [[https://community.mairlist.com/|mAirList Support Forum]] may be prone to cause issues. **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 [[https://community.mairlist.com/|mAirList Support Forum]] may be prone to cause issues.
Line 25: Line 25:
 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. 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.+Furthermore, certain procedures provide parameters related to the regarded event – for instance the ''procedure OnPlayerStart'' yields information about the assigned player, the item being played and its position within the playlist.
  
 An overview of the provided background script procedures is supplied with each version of mAirList within the file ''Background Script Template.mls''. An overview of the provided background script procedures is supplied with each version of mAirList within the file ''Background Script Template.mls''.
Line 33: Line 33:
 ===== Creating Code ===== ===== 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 [[https://notepad-plus-plus.org|Notepad++]], might be considered. The finished code is to be saved in UTF-8 format into a file **with the extension ''.mls''**.+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 [[https://notepad-plus-plus.org|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:+The structure of a simple Delphi/TurboPascal programme is as follows:
  
 <code delphi> <code delphi>
Line 62: Line 62:
 **Note** the different use of semicolon '';'' and period ''.'' in subprogramme and main programme respectively. **Note** the different use of semicolon '';'' and period ''.'' in subprogramme and main programme respectively.
  
-**Comments** may be typed into ''{''curly brackets''}'', a combination of ''(*''parentheses and asterisk''*)'' or behind a ''<nowiki>//</nowiki>'' double slash. While the former two can be expanded over multiple lines, the latter works for a single line or part of it only.+**Comments** may be typed into ''{'' curly brackets ''}'', a combination of ''(*'' parentheses and asterisk ''*)'' or behind a ''<nowiki>//</nowiki>'' double slash. While the former two can be expanded over multiple lines, the latter works for a single line or part of it only.
  
-It is highly recommended to structure the code by indenting the statements with two whitespaces at a time. [[https://community.mairlist.com/t/scripting-hilfe-grundkurs-1-wie-schreibe-ich-code/12387|A beginner’s tuorial|]] can be found in the Support Forum, however, at the time being, in German language only. {{:wiki:zeichen_123_-_arbeitsstelle_stvo_2013.svg.png?nolink&20|}}+It is highly recommended to structure the code by indenting the statements with two whitespaces at a time. 
  
 +[[https://community.mairlist.com/t/scripting-hilfe-grundkurs-1-wie-schreibe-ich-code/12387|A beginner’s tuorial]] can be found in the Support Forum, however, at the time being, in German language only. {{:wiki:zeichen_123_-_arbeitsstelle_stvo_2013.svg.png?nolink&20|}}
 +
 +==== Background Scripts ====
 +
 +As mAirList is calling //procedures// in background scripting, their code is to be placed in the //subprogramme part// of the script. This may usually leave a sole
 +
 +<code delphi>
 +begin
 +end.
 +</code>
 +
 +(''end.'' with period!) at the end, which must not be forgotten of.
 +
 +=== Parameters ===
 +
 +Certain background script procedures are passing parameters. These can be used as variables within the procedure’s code as such:
 +
 +<code delphi>
 +// This code writes the item’s title into the System Log whenever a player is started
 +
 +procedure OnPlayerStart(PlaylistIndex: integer; PlayerIndex: integer; Item: IPlaylistItem);
 +begin
 +  SystemLog(Item.GetTitle);
 +end;
 +
 +</code>
 +
 +=== Registering Background Scripts ===
 +
 +For making the code actually work with mAirList, the file has to be registered in the mAirList Control Panel:
 +
 +--> SCREENSHOT <--
 +
 +While loading, the syntax of the code is checked. In case of errors a message is written into the system log, containig (somewhat obscure) the cause of the error and its location as ''(line:column)''.
  
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki