I use an event to load the (database) playlist for the next hour. Sometimes though it is necessary to deactivate that event, for example when a pre-prepared programme is currently running.
So I would like to add a dummy element to the beginning and another one at the end of the playlist that executes a script. The first script would deactivate the scheduled event, the second one activate it again (check/uncheck “Automation” in the “Scope” group).
I would imagine that this is rather simple to achieve, perhaps in one line … but how?
Not a single line actually, but still pretty simple.
Just iterate through the event list, locate the event you’re going to modify, and use SetRunInAutomation to check or uncheck the Automation box. If there’s more than one event, you should give the particular event a unique description like “My Event” in the example below.
As always, it is a good idea to lock the list during the iteration so no other thread can modify it.
Also note that the event list is currently a property of the playlist, that is, each playlist has its own event list. This is likely to change in a future version of mAirList.
const
EventDescription = 'My Event';
var
i: integer;
begin
CurrentPlaylist.GetEventList.BeginRead;
try
for i := 0 to CurrentPlaylist.GetEventList.GetCount - 1 do
if CurrentPlaylist.GetEventList.GetItem(i).GetDescription = EventDescription then begin
// Item was found, update flags
CurrentPlaylist.GetEventList.GetItem(i).SetRunInAutomation(false);
SystemLog('RunInAutomation was disabled for ' + MyEvent);
exit;
end;
finally
CurrentPlaylist.GetEventList.EndRead;
end;
SystemLog('Did not find the event ' + EventDescription);
end.
Thanks for your help. The script is running like a charm…
The only problem I have… I don’t know how to add it to a playlist.
My initial thought was to use a dummy element and its Playback/“Actions on Start” option to run the script. However, this is only available for items that are actually ‘playable’. I thought of a container… but when it’s empty it returns “Skipping erroneous item…”. A COMMAND item perhaps? But there does not seem to be a command to run a script?
Any ideas?
Otherwise I would add the script to the first element in the database playlist, the first song or voice track— but I would rather have an item in a database folder for that, to add it quickly to playlists, rather than having to add the “Run script…” bit to “Actions on Start” and then perhaps apply that to the database permanently by mistake when editing cue points.
How can I launch a specific event? Something like this: IPlayoutInstance(Instance).GetEventList.GetItem(i).Run;
I didn’t find any documentation to act on scheduled events.
Is it possible to act on an item in the current playlist? I am trying to change the songtype of the highlighted item via a keyboard shortcut. How can I do?
Scripts cannot access the GUI, so they cannot tell which item is selected/highlighted.
As for running events from a script, it is possible with a little effort. But there may be more convenient ways to achieve what you have in mind. Maybe you can explain a little more in detail what you are trying to accomplish? What does that event do, and why do you want to run it “manually”?
I understand that a script cannot access the GUI. By default when I import a new item into the playlist, the songtype is (not set). I wanted to be able to quickly change the songtype to music or jingle, via a button or keyboard shortcut without having to open properties.
I have an event running at xx:55 to insert the playlist for the next hour. Each hour begins with a “Star of hour marker” in “Soft fixed time” so as not to cut the current song if it exceeds xx:00.
I would like that when there is a show, the loading of the playlists initially planned will not be done. When radio hosts are live with their own songs and playlist, they must manually delete the new playlists generated. I still want to generate these playlists in case there will be no live radio broadcast.
Radio hosts must also be able to easily insert the current playlist originally generated if their program ends before xx:55.
How can I do ? I was thinking of a button to activate / deactivate / execute the event, with an indicator to know the status of the event.
Is there a command to force the execution of an event?
It is possible to do it from the “Event Scheduler” window by clicking on “Run”, how to do the same thing from a script?