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
Chris Daum  
#1 Posted : Friday, April 9, 2021 6:44:14 AM(UTC)
Chris Daum

Rank: Advanced Member

Groups: Registered
Joined: 11/20/2020(UTC)
Posts: 74
Man
Germany

Thanks: 13 times
Was thanked: 9 time(s) in 9 post(s)
I admit it... I´m lost without you...

Code:
        Dim In1 As String = ""
        Dim InN1 As String = ""
        Dim x As New XmlDocument()
        x.Load("http://192.168.178.158:8088/api")

        Dim nodes As XmlNodeList = x.DocumentElement.SelectNodes("/vmix/inputs/input[2]")
        For Each node As XmlNode In nodes
            In1 = x.SelectSingleNode("//overlay[4]/@key").InnerText
        Next

        Dim nodes2 As XmlNodeList = x.DocumentElement.SelectNodes("/vmix/inputs")
        For Each node As XmlNode In nodes2
            InN1 = x.SelectSingleNode("//input[@key 'In1']/@number").InnerText
        Next


Purpose is to generate a "Red Light" frame in a custom Multi View (Blank with defined MV layout) independant
of which Input is set in the different Multi View Previews.

That for I first get the input key of the used MV overlay
check, works
then to compare with "SelectSingleNode("//active").InnerText" I need the input number, or am I wrong...
When I use the key directly e.g. 6a971275-a9...aso I easily get the corresponding number...

The rest is clear and working (RL indicating active input in multi view preview)
kross  
#2 Posted : Friday, April 9, 2021 9:12:45 AM(UTC)
kross

Rank: Advanced Member

Groups: Registered
Joined: 10/31/2020(UTC)
Posts: 144
United States

Thanks: 2 times
Was thanked: 28 time(s) in 28 post(s)
Code:
        Dim In1 As String = ""
        Dim InN1 As String = ""
        Dim x As New XmlDocument()
        x.Load("http://192.168.178.158:8088/api")

        Dim nodes As XmlNodeList = x.DocumentElement.SelectNodes("/vmix/inputs/input[2]")
        For Each node As XmlNode In nodes
            In1 = x.SelectSingleNode("//overlay[4]/@key").InnerText
        Next

        Dim nodes2 As XmlNodeList = x.DocumentElement.SelectNodes("/vmix/inputs")
        For Each node As XmlNode In nodes2
            InN1 = x.SelectSingleNode("//input[@key 'In1']/@number").InnerText
        Next


This node selection and "for each" loop aren't doing anything. They can be omitted.

Also, you probably shouldn't use a subscript of 4, but rather search for the overlay with the attribute "number" equal to 4.

Then your last line, trying to select the input, you want to use the number attribute, not the key attribute, like:

Code:
        Dim In1 As String = ""
        Dim InN1 As String = ""
        Dim x As New XmlDocument()
        x.Load("http://192.168.178.158:8088/api")

        In1 = x.SelectSingleNode("/vmix/overlays/overlay[@number='4']").InnerText
        InN1 = x.SelectSingleNode($"/vmix/inputs/input[@number='{In1}']").InnerText


The dollar sign at the start of the string tells the interpreter to replace variables in {} brackets with their actual value.

So that cleans up your existing code. I wasn't able to understand exactly what you're trying to do. But I hope this helps you in the right direction.
kross  
#3 Posted : Friday, April 9, 2021 9:21:37 AM(UTC)
kross

Rank: Advanced Member

Groups: Registered
Joined: 10/31/2020(UTC)
Posts: 144
United States

Thanks: 2 times
Was thanked: 28 time(s) in 28 post(s)
Originally Posted by: Chris Daum Go to Quoted Post
then to compare with "SelectSingleNode("//active").InnerText" I need the input number, or am I wrong...
When I use the key directly e.g. 6a971275-a9...aso I easily get the corresponding number...


Yes, the contents of the "active" element is the input number. If you want to select that input, you would do something along the lines of:

Code:
    Dim active as String = x.SelectSingleNode("/vmix/active").InnerText
    Dim activeInput as XmlNode = x.SelectSingleNode($"/vmix/inputs/input[@number='{active}']")
thanks 1 user thanked kross for this useful post.
Chris Daum on 4/9/2021(UTC)
Chris Daum  
#4 Posted : Friday, April 9, 2021 9:37:30 PM(UTC)
Chris Daum

Rank: Advanced Member

Groups: Registered
Joined: 11/20/2020(UTC)
Posts: 74
Man
Germany

Thanks: 13 times
Was thanked: 9 time(s) in 9 post(s)
Thanks Kross,

I had to do some little adjustments:

Code:
In1 = x.SelectSingleNode("//overlay[4]/@key").InnerText 
InN1 = x.SelectSingleNode($"//input[@key='{In1}']/@number").InnerText
active = x.SelectSingleNode("//active").InnerText 


but your hint with the "String Announcement" and syntax solved the issue.
With the gathered info I can control the "redlight" in the MV Overlay (GTZIP Title)

UserPostedImage
UserPostedImage

you rock!!
Users browsing this topic
Guest (2)
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.