logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
streamfuchs  
#1 Posted : Friday, May 9, 2025 8:23:17 AM(UTC)
streamfuchs

Rank: Newbie

Groups: Registered
Joined: 5/9/2025(UTC)
Posts: 4
Germany
Location: Lilienthal

Hi everyone,

I am just new to this forum and I hope that some experienced scripting users can help me with a problem I am not able to solve.

I found in VMix-Wiki a very interesting solution to realize a quadsplitt tallylight.
It uses a gtzip template as an overlay to a multiviewer quadsplitt and a script to change text and colour of the overlay, depending on which input is active.

This works pretty good but only with inputs which are directly switched to the main output.

I would like to extend the capability to inputs which are used as an overlay source on the main output.
I am a scripting beginner and tried the whole day to find a solution without any success.

Here is the script, which is doing well with the directly switched input:


do while true

Dim doc As New XmlDocument()
doc.LoadXml(API.Xml)
Dim root As XmlNode = doc.DocumentElement

Dim node As XmlNode = root.SelectSingleNode("/vmix/active")
Dim inputNumber as Integer = node.InnerXml

If inputNumber = 1 Then
Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextOL.Text") = "Kamera 1 ONAIR"
Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextOR.Text") = "Kamera 2"
Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextUL.Text") = "Kamera 3"
Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextUR.Text") = "PGM K1"
API.Function("SetTextColour",Input:="Quadsplitt_Rotlicht.gtzip",SelectedName:="HG1.Text",Value:="red")
API.Function("SetTextColour",Input:="Quadsplitt_Rotlicht.gtzip",SelectedName:="HG2.Text",Value:="black")
API.Function("SetTextColour",Input:="Quadsplitt_Rotlicht.gtzip",SelectedName:="HG3.Text",Value:="black")
'API.Function("SetTextColour",Input:="Quadsplitt_Rotlicht.gtzip",SelectedName:="HG4.Text",Value:="black")
end if

If inputNumber = 2 Then
Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextOL.Text") = "Kamera 1"
Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextOR.Text") = "Kamera 2 ONAIR"
Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextUL.Text") = "Kamera 3"
Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextUR.Text") = "PGM K2"
API.Function("SetTextColour",Input:="Quadsplitt_Rotlicht.gtzip",SelectedName:="HG1.Text",Value:="black")
API.Function("SetTextColour",Input:="Quadsplitt_Rotlicht.gtzip",SelectedName:="HG2.Text",Value:="red")
API.Function("SetTextColour",Input:="Quadsplitt_Rotlicht.gtzip",SelectedName:="HG3.Text",Value:="black")
'API.Function("SetTextColour",Input:="Quadsplitt_Rotlicht.gtzip",SelectedName:="HG4.Text",Value:="black")
end if

If inputNumber = 3 Then
Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextOL.Text") = "Kamera 1"
Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextOR.Text") = "Kamera 2"
Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextUL.Text") = "Kamera 3 ONAIR"
Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextUR.Text") = "PGM K3"
API.Function("SetTextColour",Input:="Quadsplitt_Rotlicht.gtzip",SelectedName:="HG1.Text",Value:="black")
API.Function("SetTextColour",Input:="Quadsplitt_Rotlicht.gtzip",SelectedName:="HG2.Text",Value:="black")
API.Function("SetTextColour",Input:="Quadsplitt_Rotlicht.gtzip",SelectedName:="HG3.Text",Value:="red")
'API.Function("SetTextColour",Input:="Quadsplitt_Rotlicht.gtzip",SelectedName:="HG4.Text",Value:="black")
end if

sleep (200)
loop



For input e.g. 26 the corresponding node in the vmix API XML-File is

<active>26</active>

for the same input on lets say overlay 1 it is:

<overlays>
<overlay number="1">26</overlay>
<overlay number="2"/>
<overlay number="3"/>
<overlay number="4"/>
<overlay number="5"/>
<overlay number="6"/>
<overlay number="7"/>
<overlay number="8"/>

Is there any good idea how to change the script to meet the overlay needs?
I do not know whether it is possible within one script for active and overlay or whether it is easier to have two ore more scripts or whether it is possible at all.

Any help is very appreciated.
nikosman88  
#2 Posted : Friday, May 9, 2025 9:16:21 PM(UTC)
nikosman88

Rank: Advanced Member

Groups: Registered
Joined: 12/24/2021(UTC)
Posts: 660
Greece
Location: athens

Thanks: 157 times
Was thanked: 85 time(s) in 81 post(s)
Hi. A script template for overlay 1 channel
Code:

Do While True
    Dim doc As New XmlDocument()
    doc.LoadXml(API.XML())
    Dim root As XmlNode = doc.DocumentElement

    ' Πάρε το input που είναι στο Overlay 1
    Dim overlayNode As XmlNode = root.SelectSingleNode("//overlay[@number='1']")
    Dim overlayInput As Integer = -1
    If overlayNode IsNot Nothing AndAlso Not String.IsNullOrEmpty(overlayNode.InnerText) Then
        overlayInput = Integer.Parse(overlayNode.InnerText)
    End If

    ' Πάρε το ενεργό (PGM) input
    Dim activeNode As XmlNode = root.SelectSingleNode("/vmix/active")
    Dim activeInput As Integer = -1
    If activeNode IsNot Nothing Then
        activeInput = Integer.Parse(activeNode.InnerText)
    End If

    ' ➕ Κανονικά labels
    Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextOL.Text") = "Kamera 1"
    Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextOR.Text") = "Kamera 2"
    Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextUL.Text") = "Kamera 3"

    ' ➕ Όλα HG μαύρα
    API.Function("SetTextColour", Input:="Quadsplitt_Rotlicht.gtzip", SelectedName:="HG1.Text", Value:="black")
    API.Function("SetTextColour", Input:="Quadsplitt_Rotlicht.gtzip", SelectedName:="HG2.Text", Value:="black")
    API.Function("SetTextColour", Input:="Quadsplitt_Rotlicht.gtzip", SelectedName:="HG3.Text", Value:="black")

    ' ➕ Ανάλογα το overlay input → ONAIR + κόκκινο
    If overlayInput = 1 Then
        Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextOL.Text") = "Kamera 1 ONAIR"
        API.Function("SetTextColour", Input:="Quadsplitt_Rotlicht.gtzip", SelectedName:="HG1.Text", Value:="red")
    ElseIf overlayInput = 2 Then
        Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextOR.Text") = "Kamera 2 ONAIR"
        API.Function("SetTextColour", Input:="Quadsplitt_Rotlicht.gtzip", SelectedName:="HG2.Text", Value:="red")
    ElseIf overlayInput = 3 Then
        Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextUL.Text") = "Kamera 3 ONAIR"
        API.Function("SetTextColour", Input:="Quadsplitt_Rotlicht.gtzip", SelectedName:="HG3.Text", Value:="red")
    End If

    ' ➕ Ανάλογα το active input → PGM Kx
    If activeInput = 1 Then
        Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextUR.Text") = "PGM K1"
    ElseIf activeInput = 2 Then
        Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextUR.Text") = "PGM K2"
    ElseIf activeInput = 3 Then
        Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextUR.Text") = "PGM K3"
    Else
        Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextUR.Text") = ""
    End If

    Sleep(200)
Loop

Kamera 1 to 3 labels are meant to be red if one of the specific inputs is on overlay 1 while label PGM takes k1 to k3 values if any of the 3 specific inputs is active
streamfuchs  
#3 Posted : Friday, May 9, 2025 9:52:17 PM(UTC)
streamfuchs

Rank: Newbie

Groups: Registered
Joined: 5/9/2025(UTC)
Posts: 4
Germany
Location: Lilienthal

Hi,
thanks for the script.
Yes, this is working, but do you think it would be possible, to have the Tally indication as red marked labels, either when the input is on overlay or when the input is switched directly to the output?
nikosman88  
#4 Posted : Friday, May 9, 2025 11:59:07 PM(UTC)
nikosman88

Rank: Advanced Member

Groups: Registered
Joined: 12/24/2021(UTC)
Posts: 660
Greece
Location: athens

Thanks: 157 times
Was thanked: 85 time(s) in 81 post(s)
See this version if fits what you need
Code:

Do While True
    Dim doc As New XmlDocument()
    doc.LoadXml(API.XML())
    Dim root As XmlNode = doc.DocumentElement

    ' Get active (PGM) and Overlay1 inputs
    Dim activeInput As Integer = -1
    Dim overlayInput As Integer = -1

    Dim activeNode As XmlNode = root.SelectSingleNode("/vmix/active")
    If activeNode IsNot Nothing Then
        activeInput = Integer.Parse(activeNode.InnerText)
    End If

    Dim overlayNode As XmlNode = root.SelectSingleNode("//overlay[@number='1']")
    If overlayNode IsNot Nothing AndAlso Not String.IsNullOrEmpty(overlayNode.InnerText) Then
        overlayInput = Integer.Parse(overlayNode.InnerText)
    End If

    ' Reset all HG colors to black
    API.Function("SetTextColour", Input:="Quadsplitt_Rotlicht.gtzip", SelectedName:="HG1.Text", Value:="black")
    API.Function("SetTextColour", Input:="Quadsplitt_Rotlicht.gtzip", SelectedName:="HG2.Text", Value:="black")
    API.Function("SetTextColour", Input:="Quadsplitt_Rotlicht.gtzip", SelectedName:="HG3.Text", Value:="black")

    ' Camera 1
    Dim cam1_text As String = "Kamera 1"
    If activeInput = 1 And overlayInput = 1 Then
        cam1_text = "Kamera 1 is ON AIR and Overlay1"
        API.Function("SetTextColour", Input:="Quadsplitt_Rotlicht.gtzip", SelectedName:="HG1.Text", Value:="red")
    ElseIf activeInput = 1 Then
        cam1_text = "Kamera 1 is ON AIR"
        API.Function("SetTextColour", Input:="Quadsplitt_Rotlicht.gtzip", SelectedName:="HG1.Text", Value:="red")
    ElseIf overlayInput = 1 Then
        cam1_text = "Kamera 1 is on Overlay1"
        API.Function("SetTextColour", Input:="Quadsplitt_Rotlicht.gtzip", SelectedName:="HG1.Text", Value:="red")
    End If
    Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextOL.Text") = cam1_text

    ' Camera 2
    Dim cam2_text As String = "Kamera 2"
    If activeInput = 2 And overlayInput = 2 Then
        cam2_text = "Kamera 2 is ON AIR and Overlay1"
        API.Function("SetTextColour", Input:="Quadsplitt_Rotlicht.gtzip", SelectedName:="HG2.Text", Value:="red")
    ElseIf activeInput = 2 Then
        cam2_text = "Kamera 2 is ON AIR"
        API.Function("SetTextColour", Input:="Quadsplitt_Rotlicht.gtzip", SelectedName:="HG2.Text", Value:="red")
    ElseIf overlayInput = 2 Then
        cam2_text = "Kamera 2 is on Overlay1"
        API.Function("SetTextColour", Input:="Quadsplitt_Rotlicht.gtzip", SelectedName:="HG2.Text", Value:="red")
    End If
    Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextOR.Text") = cam2_text

    ' Camera 3
    Dim cam3_text As String = "Kamera 3"
    If activeInput = 3 And overlayInput = 3 Then
        cam3_text = "Kamera 3 is ON AIR and Overlay1"
        API.Function("SetTextColour", Input:="Quadsplitt_Rotlicht.gtzip", SelectedName:="HG3.Text", Value:="red")
    ElseIf activeInput = 3 Then
        cam3_text = "Kamera 3 is ON AIR"
        API.Function("SetTextColour", Input:="Quadsplitt_Rotlicht.gtzip", SelectedName:="HG3.Text", Value:="red")
    ElseIf overlayInput = 3 Then
        cam3_text = "Kamera 3 is on Overlay1"
        API.Function("SetTextColour", Input:="Quadsplitt_Rotlicht.gtzip", SelectedName:="HG3.Text", Value:="red")
    End If
    Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextUL.Text") = cam3_text

    ' Show which input is on PGM (top right label)
    Dim pgmText As String = ""
    If activeInput = 1 Then pgmText = "PGM K1"
    If activeInput = 2 Then pgmText = "PGM K2"
    If activeInput = 3 Then pgmText = "PGM K3"
    Input.Find("Quadsplitt_Rotlicht.gtzip").Text("TextUR.Text") = pgmText

    Sleep(200)
Loop

streamfuchs  
#5 Posted : Saturday, May 10, 2025 12:33:17 AM(UTC)
streamfuchs

Rank: Newbie

Groups: Registered
Joined: 5/9/2025(UTC)
Posts: 4
Germany
Location: Lilienthal

Hi,

yes thank you very much, this is what I want to use.

One last question when possible:

Could you exchange the obviously cyrillic expressions against english expressions?
That would make it much easier for me to integrate it into my workaround.

Thanks a lot in advance.
nikosman88  
#6 Posted : Saturday, May 10, 2025 1:25:21 AM(UTC)
nikosman88

Rank: Advanced Member

Groups: Registered
Joined: 12/24/2021(UTC)
Posts: 660
Greece
Location: athens

Thanks: 157 times
Was thanked: 85 time(s) in 81 post(s)
Hi, thanks for your feedback! Just to clarify — the expressions you mentioned were actually written in Greek (not Cyrillic). I've now updated all comments in the script to English for easier integration.
streamfuchs  
#7 Posted : Saturday, May 10, 2025 8:52:20 AM(UTC)
streamfuchs

Rank: Newbie

Groups: Registered
Joined: 5/9/2025(UTC)
Posts: 4
Germany
Location: Lilienthal

Thanks a lot.
That makes it much easier for me to implement.
And sorry because of my error with reference to greek and Cyrillic.
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.