Can mairlist scripts include other scripts?


I have code that I would like to use in more than one mls script.

Can I import code like this (functions & procedures) into the mls scripts where I need to use it
or do I need to cut and paste the same code into every mls script I write?

An example is this function that generates a somewhat random id.

function generate_ext_id(i: integer): string;

// generate a good enough random external playlist id
var s: string;
    j: integer;
  s := '#E';
  for j := 1 to 5 do
      s := s + chr(65 + random(25));
  s := s + '-' + inttostr(i);
  result := s;

Inclusion works using a “special” comment syntax:

{$Include path\to\}

You can also defend against multiple inclusion using a preprocessor constant. If, for example, you put the following inside


You can then put this in any script that needs the functions and procedures defined in

	{$Include path\to\}


Interesting information; never relalized the defines and ifdef/ifndefs worked in scripts. (The scripting engine is not my work but a 3rd party library.)