Am looking for a script that will load up the event scheduler and load the events scheduled into the scheduler. Have tried to search but no joy.
Any help would be appreciated.
Mike: I’m not clear as to precisely what you mean?
Is your aim to have two scripts which are:
-
‘Add’ Events to the Event Scheduler, and
-
‘Read’ or ‘copy’ Events already set up in the Scheduler, either to process them and/or to save them in a more human-readable format, or for potential re-loading at a later time?
I know of some Event interfaces in the scripting language (IEventList, IEventListItem, etc.), so what you are requesting should be ‘do-able,’ but I have never used those particular ‘widgets’ myself.
Best to wait until Torben can give you some sample code rather than relying on my rather sketchy knowledge of that area of mAirList scripting!
PS: If it helps, the place to look is in mAirListScript.chm; then just ‘rummage!’
BFN
CAD
The aim is to have a script load events scheduled for a specific day on startup of mAirlist.
Let me clarify; I have certain promos and ads to be played on each day of the week and currently all of them are in one saved event schedule which I manually load. This schedule is very long and confusing so I wanted to break it down in a saved schedule for each day (mondays events in a monday schedule, etc) and have a script to load the correct saved events schedule on each day.
I hope this makes sense…
Mike: Yes, I understand now.
There would be no need to break the schedule into ‘daily’ parts. In fact, from a programming point of view, it is better if all your events are in one big file! [Why? Because then the filename won’t change, nor will the script need to ‘work out’ the correct filename to load …]
(Incidentally: if you do want to split the file, you can use any text file editor—even Notepad!—to do that. Like almost all mAirList data files, an MLE file is just an XML file with a specific extension to indicate its purpose in mAirList. It’s instructive to look into these to get a better understanding of how things like Events are saved, and also VERY useful if you need to make a quick ‘tweak’ to something. ;D)
But I’m saying all this to stall for time.
I’ve never used scripting to load an Event file, so I’m unfamiliar with those particular scripting objects. But in principle, you would need to write two scripts.
The first script would load the Event file(s). This would be along the lines of:
EventList.LoadFromFile('driveletter:\path\file name.mle');
such as:
EventList.LoadFromFile('D:\mAirList Files\My Events.mle');
… but as I said above, I have not written a script to do that (nor do I currently have the time to try it: sorry!). No doubt Torben will be along soon to tell you the correct code to use: mine (above) is just a ‘guess’ based on the mAirListScript Help file.
The second script you would need to add (or modify) is a Notification script, in which you would add code to OnStartup to run the ‘load the Event list’ script.
BFN
CAD
Thanks Cad, I will wait till Torben can have his input…will see it in a couple of weeks after wedding and honeymoon.
Dear Mike,
OK then, to save you the wait, here’s a Notification Script what I have wrote for mAirList V2.x which will do what you originally asked for (i.e. load the correct day’s MLE file from your set of seven ‘daily’ MLE files):
// LoadEventsAtStartup script - Loads an MLE file into an Event List
// (Notification script)
// Written by Cad Delworth, Clearances Manager, Leith FM, Edinburgh, Scotland
// http://www.leithfm.co.uk
const
// Change the CONSTs below to match the directory and MLE file names
EVENT_FILE_NAME_PREFIX = 'C:\Documents and Settings\Cad.TARDIS\My Documents\mAirList\';
EVENT_FILE_NAME_SUFFIX = 'Events.mle';
// Change the CONST below to load Events for a different Playlist
// Playlists in scripting are numbered from 0 upwards (not 1!).
PLAYLIST_NUM = 0;
var
myEventList: IEventList;
procedure OnStartup;
begin
myEventList := PlaybackControl(PLAYLIST_NUM).GetEventList;
myEventList.LoadFromFile(
EVENT_FILE_NAME_PREFIX
+ FormatDateTime('ddd', Now)
+ EVENT_FILE_NAME_SUFFIX
);
end;
begin
end.
Load the above into Notepad, change EVENT_FILE_NAME_PREFIX to = the drive and path to the directory where you keep your MLE event files, then save the script somewhere sensible (your Program Files\mAirList\Scripts\Notification directory is good).
Name the saved file LoadEventsAtStartup.mls (or some equally sensible name).
Then, in mAirList Config, select Scripting, Notification Scripts, and Add this script to the list.
Make sure that your MLEs are named MonEvents.mle, TueEvents.mle, etc. and it will all work.
Note that this script will load the events ONLY at mAirList STARTUP time, so it presupposes that you close mAirList every night and re-start it daily. If you have mAirList running 24/7, or overnight, we’ll need to come up with a different solution.
PS: If you use v3.x of mAirList, and the above doesn’t work, I’m sure someone else can make any necessary changes for you. I haven’t got as far as trying v3.x yet.
BFN
CAD