mAirListScript Changes

I’m guessing that some scripts will stop in v4. I have a small script that simply parses the playlist looking for MUSIC tracks and adds the Title - Artist to a Stringlist and then saves that to the desktop. It causes the following error:

Error executing action: Runtime error: (29,4) Exception: Access violation at address 005575AD in module ‘mAirList.exe’. Write of address 00000000

Line 29 is currentItem := currentPlaylist.GetItem(i);

I haven’t filed a bug report as it may be expected with some script changes needed.

[code]// Simple Text Export for ARTIST - TITLE on MUSIC tracks
// With thanks for CAD for his excellent commented IVP scripts which made this relatively easy.

const
SCRIPTNAME = ‘Export Music Items to Text File v1.0’;

// Enter the full path and filename of the textfile you want to save the text file to. Remember to copy/rename the file before you run the script on another playlist!
TEXTFILENAME = ‘C:\Documents and Settings\All Users\Desktop\Playlist.txt’;

var
iMax, iItemCount, i : integer;
szPlaylist, szWarning, szArtist, szTitle, szLine: string;
currentItem: IPlaylistItem;
slTextItems : TStringList;

begin
szPlaylist := IntToStr(CurrentPlaybackControl.GetIndex + 1);
iItemCount := CurrentPlaylist.GetCount;
if iItemCount < 1 then
SystemLog(SCRIPTNAME + 'Needs some items in ’ + szPlaylist + ‘, then try again.’)
else
begin
SystemLog(SCRIPTNAME + ‘Processing Playlist for text file export ’ + szPlaylist + ’ (’+ IntToStr(iItemCount)+ ’ items) to ’ + TEXTFILENAME + ‘.’);
slTextItems := TStringList.Create;
iMax := iItemCount - 1;
for i := 0 to iMax do
begin
currentItem := CurrentPlaylist.GetItem(i);
szArtist := currentItem.GetArtistsString;
szTitle := currentItem.GetTitle;
if (currentItem.GetItemType = pitMusic) then
begin
szLine := szArtist + ’ - ’ + szTitle;
slTextItems.add(szLIne);
end;
end;
slTextItems.SaveToFile(TEXTFILENAME);
slTextItems.Free;
end;
end.
[/code]

Cheers, Richard

Will try to reproduce it.

Turned out that scripting was broken in Beta 1 because of non-compatible code in the script interface units. Will be fixed in b1118.