Action on start of item (in script?) question

With the help of ‘actions on start’ in an item you can, for example, set a jingle for a playlist to go on automation as soon as it is started in assist. Now I would like to add a limitation to this.

Yes, I also know that you can use ‘linked to next item’, but that presents the same challenge.

I want that as soon as an item time ‘jingle’ in player 1 or 2 is played from playlist 1, this playlist goes into automation mode.
I don’t want that to happen when this jingle is started in a player of another playlist, or when the jingle is played in a cartwall.

So it would be best to have a script that detects whether an item type ‘Jingle’ is being played in player 1 or 2 of playlist 1, and as soon as that is, playlist 1 goes to automation mode. (Obviously this can eventually be applied to all types)

Due to circumstances I really don’t want to use linked to next item. so that’s not an option for me.

Surely there must be a script that detects what type of item is being played in a specific player? Could someone help me out with that.

Should be no big deal:

procedure OnPlayerStateChange(PlaylistIndex: integer; PlayerIndex: integer; 
  OldState: TPlayerState; NewState: TPlayerState; Item: IPlaylistItem);
begin
  if NewState = psPlaying then
    if (Item.GetItemType = pitJingle) AND (PlaylistIndex = 0) then
      ExecuteCommand('AUTOMATION 1 ON');
end;

begin
end.

(Typed down by heart, untested.)

Thatis exactly the script.
I was doing some testing myself, but this is exactly doing what I searched for! Thx.
I keep learning on scripting, there will be a day that I don’t have to ask u anymore haha.

1 Like