Datatypes in scripts?

Hello!

What data types are available for use in scripts?

integer, string, array, double, char, date?

Is there any reference to what is implemented in mAirlist script?

Pascal Script is very powerful I use it myself … but it depends on what you’ve built in support.

/patrik
Vårgårda Sweden

All the basic data types from Delphi should be available. (Is there a way to exclude certain types anyway? I don’t think so.)

A reference of the internal objects/interfaces can be found here: http://www.mairlist.com/download/mAirList/v3.1/scriptinghelp/mAirListScript.chm

It doesn’t include any comments, but it’s built automatically from the mAirList source code, so should be very complete.

Thanks for that!
The file need to be signed to work without problems. Works poorly if it is in any of the Windows special folders.
Got to move it to my c:\000 workfolder to get it to work.

But can not find a function for Fileexists()?

Adapted from Torben’s scripts\notification\LogItemsToFile.mls script:

function FileExists(sFileName: string): boolean; var sl: TStringList; begin sl := TStringList.Create; try // wrap loading in a try..except block in case the file does not exist try Result := true; sl.LoadFromFile(sFileName); except Result := false; end; finally sl.Free; end; end;

You might also find some of my scripts useful and hopefully educational. The ZIPfiles contain fully-commented versions as well as ‘stripped’ ones to make them run slightly faster.

Here are some links for you:
IVP: http://forum.mairlist.com/index.php/topic,4631.0.html
YearJingleAdder: http://forum.mairlist.com/index.php/topic,4658.0.html
PerfectTime (collaboration): http://forum.mairlist.com/index.php/topic,2645.0.html

Those should demonstrate many useful mAirListScript techniques for you. 8)

BFN
CAD

[quote=“patrikekman, post:3, topic:7216”]The file need to be signed to work without problems. Works poorly if it is in any of the Windows special folders.
Got to move it to my c:\000 workfolder to get it to work.[/quote]

I don’t know how to sign that file. You probably need to register with Microsoft to obtain a key or so.

From my experience, you just need to uncheck the “ask me every time” box in the “warning, this is a downloaded file” dialog that appears when you open it for the first time. All pages will show fine then, even when the file is on a network share or so.

But can not find a function for Fileexists()?

Looks like it’s not imported by Pascal Script by default. I will add it. The workaround mentioned by Cad will work for the moment, but it’s only practical for small files. (Not a good idea to read a 500 MB WAV file into a string list just to check if the file exists.)

(Note that most of the functions imported directly from Delphi aren’t mentioned in the CHM file - it’s only about mAirList’s internal interfaces.)

I like Trial and error… :slight_smile:

Ps. load a m3u playlist? where did i find referens for that in the script references?

In Windows 7, it gets funny (security) and won’t show the content pages. If you right-click the file, click on Properties then click “Unblock”, then all is well. Certainly doesn’t need to be signed here.

I’m darned if I can find it in the CHM right now, but the syntax is:
Playlist(playlist-index-number).LoadFromFile(filename-string);

or just:
CurrentPlaylist.LoadFromFile(filename-string);
if you have only one Playlist. Playlists are numbered from zero upwards.

To Insert (rather than Load) the file, use this instead of .LoadFromFile:
.InsertFile(item-number, filename-string)
item-number is the item number in the Playlist after which you want to Insert the file.

I don’t think there’s a .AppendFile, but you could fake one like this:

procedure AppendFileToCurrentPlaylist(sFilename : string); var iItemCount: integer; begin iItemCount := CurrentPlaylist.GetCount; CurrentPlaylist.InsertFile(iItemCount, sFilename); end;

Hope that helps.

Oh: and to answer your question about M3Us, the InsertFile method can handle M3Us, MLPs, or single audio files; so yes, you can import/insert/append M3Us.

BFN
CAD

Thanks!

I know I’m bad at searching but: what commands can be sent in a m3u file?

/patrik

Sorry, no idea: I don’t use m3u files!

BFN
CAD