vMix Forums
»
General
»
3rd Party Software and Development
»
Find Active input and preview another input
Rank: Newbie
Groups: Registered
Joined: 7/7/2022(UTC) Posts: 9 Location: Israel
|
Hi all I need help writing a VB.NET script That find the active input and:
if the name of the active input is "Name Input 1" - preview input "Name Input 11" if the name of the active input is "Name Input 2" - preview input "Name Input 22" if the name of the active input is "Name Input 3" - preview input "Name Input 33" if the name of the active input is "Name Input 4" - preview input "Name Input 44"
(I want to be able to determine the Input name) Thanks in advance Adi
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,215 Location: Belgium Thanks: 291 times Was thanked: 955 time(s) in 790 post(s)
|
Originally Posted by: AdiA Hi all I need help writing a VB.NET script That find the active input and:
if the name of the active input is "Name Input 1" - preview input "Name Input 11" if the name of the active input is "Name Input 2" - preview input "Name Input 22" if the name of the active input is "Name Input 3" - preview input "Name Input 33" if the name of the active input is "Name Input 4" - preview input "Name Input 44"
(I want to be able to determine the Input name) Thanks in advance Adi Check out the "scripting for dummies" post in this forum (and others) Get the active input number (vMix API XML) , based on that get the input number's name , do logic to search for input with name x and put it in preview Might be easier to just work with input numbers rather than names ;-)
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 7/7/2022(UTC) Posts: 9 Location: Israel
|
Thanks Doggy
I do not know how to write VB NET scripting. I was hoping someone here could help me with that...:) I can pay if needed
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,215 Location: Belgium Thanks: 291 times Was thanked: 955 time(s) in 790 post(s)
|
Originally Posted by: AdiA I do not know how to write VB NET scripting.
This is not what your question implied! - "I need help writing a VB.NET script to ... " - "I want to be able to determine the Input name" Quote: I was hoping someone here could help me with that...:)
LOL To much information missing regarding your end goal and "flexible" operation wish Why not simply use a trigger on each of these specific inputs ? "OnTransitioIn - PreviewInput - (with small delay!)
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 7/7/2022(UTC) Posts: 9 Location: Israel
|
First of all and I'm sorry if my post was not clear.
The reason I do not use the trigger is because i have 3 camera inputs and i switch between them most of the time. I need my preview input clean for other assets and want this script start just when i press a shortcut.
If anyone can help me write the code I would really appreciate it (like i say i don't care to pay if needed)
Thanks
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,215 Location: Belgium Thanks: 291 times Was thanked: 955 time(s) in 790 post(s)
|
Originally Posted by: AdiA I need my preview input clean for other assets and want this script start just when i press a shortcut.
If anyone can help me write the code I would really appreciate it (like i say i don't care to pay if needed)
See this is what i mean by missing information ( when pressing shortcut) In order for someone to write you a script or scripts (for different buttons for example) you need to detail what you want done exactly, based on what criteria , exact input details (names , possible changes etc) unless you want to pay (more) for the time too to go forth and back first for the programmer to understand first what exactly you want done and how! as you are implying you only need 3 situations where this will happen when you will feel fit to happen a simple shortcuts to put a specific input in preview as it looks like you really do not need some sort of automation to check unless it needs to be done with only one shortcut (button) instead of 3
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,215 Location: Belgium Thanks: 291 times Was thanked: 955 time(s) in 790 post(s)
|
Here you go in most simple form an you owe me a few beers worth (not kidding) Code:dim xml as string = API.XML()
dim InputActiveName as string = ""
dim activeinput as string = ""
dim x as new system.xml.xmldocument
x.loadxml(xml)
activeinput = (x.SelectSingleNode("//active").InnerText)
InputActiveName = (x.SelectSingleNode("//input[@number='"& activeinput &"']/@title").Value)
if InputActiveName = "Name Input 1"
API.Function("PreviewInput",Input:="Name Input 11")
elseif InputActiveName = "Name Input 2"
API.Function("PreviewInput",Input:="Name Input 22")
elseif InputActiveName = "Name Input 3"
API.Function("PreviewInput",Input:="Name Input 33")
elseif InputActiveName = "Name Input 4"
API.Function("PreviewInput",Input:="Name Input 44")
end if
|
1 user thanked doggy for this useful post.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 7/7/2022(UTC) Posts: 9 Location: Israel
|
It's perfect ..:) thanks a lot for the help and patience
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 7/7/2022(UTC) Posts: 9 Location: Israel
|
I'm trying to duplicate the code to do the same Process again but it looks like it's being ignored:
dim xml as string = API.XML() dim InputActiveName as string = "" dim activeinput as string = ""
dim x as new system.xml.xmldocument x.loadxml(xml)
activeinput = (x.SelectSingleNode("//active").InnerText) InputActiveName = (x.SelectSingleNode("//input[@number='"& activeinput &"']/@title").Value)
if InputActiveName = "BG Left" API.Function("CutDirect",Input:="Split Screen - Left") API.Function("PreviewInput",Input:="Input_1_F") elseif InputActiveName = "BG Center CUT" API.Function("CutDirect",Input:="Split Screen - Center") API.Function("PreviewInput",Input:="Input_2_F") elseif InputActiveName = "BG Right" API.Function("CutDirect",Input:="Split Screen - Right") API.Function("PreviewInput",Input:="Input_3_F") elseif InputActiveName = "Name Input 4" API.Function("CutDirect",Input:="Split Screen - Left") API.Function("PreviewInput",Input:="Input_4_F") end if
sleep(100) API.Function("Transition1")
///The script works very well up to this point, I'm trying to duplicate the code to do the same Process again but it looks like it's being ignored///
sleep(3000) if InputActiveName = "Input_1_F" API.Function("PreviewInput",Input:="Guest 1 + BG") elseif InputActiveName = "Input_2_F" API.Function("PreviewInput",Input:="Guest 2 + BG") elseif InputActiveName = "Input_3_F" API.Function("PreviewInput",Input:="Guest 3 + BG") elseif InputActiveName = "Input_4_F" API.Function("PreviewInput",Input:="Guest 4 + BG") end if
sleep(100) API.Function("Transition1")
Thanks again..)
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,215 Location: Belgium Thanks: 291 times Was thanked: 955 time(s) in 790 post(s)
|
Originally Posted by: AdiA I'm trying to duplicate the code to do the same Process again but it looks like it's being ignored:
///The script works very well up to this point, I'm trying to duplicate the code to do the same Process again but it looks like it's being ignored///
of course. It's not ignoring but acting correctly as variable InputActiveName still is the initially retrieved title name if one wants to mess with codes oneself it's best to learn some of the basic logic of coding. what started as "i just want this to happen" .... oh perfect,tnx ... but it is not doing this and that ? ;-)
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 8/15/2013(UTC) Posts: 97 Location: Could be Australia could be Europe/UK! Thanks: 1 times Was thanked: 7 time(s) in 7 post(s)
|
Just adding something I found out today (with the help of ChatGPT just a little) How to find the active input of a vMix sub mix Code:Dim doc As New XmlDocument()
doc.LoadXml(API.Xml)
Dim root As XmlNode = doc.DocumentElement
Dim node As XmlNode = root.SelectSingleNode("/vmix/mix[@number='3']/active")
Dim inputNumber as Integer = node.InnerXml
If inputNumber = "6" Then
API.Function("Merge",Input:="CAM 2",Mix:="2")
Else
API.Function("Cut",Input:="CAM 2",Mix:="2")
End If
Little quirk: When getting the info from the API the mix numbers are 1,2,3 and so on. When switching to a mix using the API then the mix numbers are 0,1,2 and so on.
|
|
|
|
vMix Forums
»
General
»
3rd Party Software and Development
»
Find Active input and preview another input
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.
Important Information:
The vMix Forums uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close