I know its been 4 years since, but here's the way if someone is still interested how to run program in LME:
1. you must begin the script with function keyword, like:
function matr_analys
...
...
endfunction (optional)
2. Put this function into .lml file, like matrix.lml, UTF8 encoding is accepted
3. You must add folder with matrix.lml inside, to Tools/options/Paths of libraries box.
4. Now, add reference to your script into lmecodefragments.xml located in Calegra folder on your PPC. This xml is a description of tidbits tree table available in tools menu in LME. You can also make new subfolder inside the tidbits structure. For instance:
<item>
<label>Matrices</label>
<subtree expanded="false">
<item>
<label>Matrix analysis</label>
<data>use matrix;matr_analys</data>
</item>
</subtree>
</item>
This will add Matrices subtree and Matrix analysis item inside, doubleclick on it will start the matr_analys function.