User Tools

Site Tools


scripting2

Differences

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

Link to this comparison view

Next revision
Previous revision
Last revisionBoth sides next revision
scripting2 [2020/07/10 10:45] – created tondosescripting2 [2020/07/13 14:25] 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 found, formatted 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 mAirList 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 (see below). 
 + 
 +**Note 2:** Currently there is no listing which keywords of the complete //Delphi/TurboPascal// catalogue will work and which don’t. However, the subset is sufficent for most of all scripting projects. In case of doubt, the respective keyword just will not work – nothing will be damaged.
  
 \\  \\ 
Line 13: Line 15:
 ===== Creating Code ===== ===== Creating Code =====
  
-The code can simply be typed into a text editorWindows-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 editorWindows-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 25: Line 27:
   // Variable declarations   // Variable declarations
  
-{ Subprogramme definitions }+{ Subprogramme definitions}
  
 procedure DoSomething; procedure DoSomething;
Line 32: Line 34:
 end; end;
  
-(* Main programme *)+(* Main programme*)
  
 begin begin
Line 46: Line 48:
 It is highly recommended to structure the code by indenting the statements with two whitespaces at a time.  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|}}+[[https://community.mairlist.com/t/scripting-hilfe-grundkurs-1-wie-schreibe-ich-code/12387|A beginner’s tuorial]] as well as a great many of code examples can be found in the Support Forum, the tutorial however, at the time being, in German language only. {{:wiki:zeichen_123_-_arbeitsstelle_stvo_2013.svg.png?nolink&20|}}
  
 \\  \\ 
Line 64: Line 66:
 </code> </code>
  
-(''end.'' with period!) at the end, which must not be forgotten of.+at the end (''end.'' with period!), which must not be forgotten of.
  
 === Parameters === === Parameters ===
Line 71: Line 73:
  
 <code delphi> <code delphi>
-// This code writes the item’s title into the System Log whenever a player is started+// This code writes the item’s title into the System Log whenever a player is started:
  
 procedure OnPlayerStart(PlaylistIndex: integer; PlayerIndex: integer; Item: IPlaylistItem); procedure OnPlayerStart(PlaylistIndex: integer; PlayerIndex: integer; Item: IPlaylistItem);
Line 77: Line 79:
   SystemLog(Item.GetTitle);   SystemLog(Item.GetTitle);
 end; end;
 +
 +begin
 +end.
  
 </code> </code>
 +
 +**NOTE: It is absolutely essential to adopt the parameters in these ''On…''-procedures as given in the current version of ''Background Script Template.mls''!** Notably older scripts have to be checked thereupon before being implemented.
  
 \\  \\ 
Line 84: Line 91:
 ===== Running Scripts ===== ===== Running Scripts =====
  
-**Standalone scripts** are run by external action, such as the menu item ''mAirList > Run Script...'' or the [[reference:remote_control_commands|remote control command]] ''RUNSCRIPT <file>''.+**Standalone scripts** are run by external action, such as the menu item 
 + 
 +''mAirList > Run Script...'' 
 +   
 +or the [[reference:remote_control_commands|remote control command]] 
 + 
 +''RUNSCRIPT <file>''.
  
 For making **background scripts** actually work with mAirList, the file has to be registered in the mAirList Control Panel: For making **background scripts** actually work with mAirList, the file has to be registered in the mAirList Control Panel:
Line 90: Line 103:
 --> SCREENSHOT <-- --> 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)''.+While loading, the syntax of the code is checked. In case of errors a message is written into the system log, containing (somewhat obscure) the cause of the error and its location as ''(line:column)'' within your ''.mls'' file.
  
  

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki