vMix Forums
»
General
»
General Discussion
»
Scripting: I'd like to pass a Dynamic Input value from one script to another
Rank: Member
Groups: Registered
Joined: 8/17/2020(UTC) Posts: 13 Location: York Thanks: 3 times
|
I'm looking for a little help. I'm setting a dynamic input value in one script [Dynamic1], and would like to be able to pass it onto another script. Basically, I'm using a stream deck button to call the first scrip using API.Functions that sends a selected PowerPoint(of which there several PPTs to be used throughout the service) to the Output, & sets up a DynamicInput1 value = PPT input number. I then want to use another button to call second script to perform a function (select NextPicture) on that DynamicInput. I've performed this function using shortcut setup directly in VMIX. But can't seem to get it to work using scripting. I keep getting an error in the 2nd script "Dynamic1' not declared. I was hoping that I would need to use VB, but also not sure how do that in VB - passing values from one script to another. I'm using Companion to trigger the scripts, as I have other applications that I use the stream deck and Companion for. The following is what I set up for scripts (there would one script set up for each PPT input, and then just a single function script to change slides):
Script 1: API.Function("Merge",Duration:=2000,Input:=4) API.Function("SetDynamicInput1",4)
Script 2: API.Function("NextPicture",Dynamic1)
The 'Dynamic1' set as the value for the NextPicture Function is where I get the "not declared" error message.
Not sure what I'm doing wrong. Thanks in advance.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 2/23/2019(UTC) Posts: 556
Thanks: 62 times Was thanked: 130 time(s) in 118 post(s)
|
Read the dynamic values/inputs from the XML API. See Scripting for Dummies post for examples.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,218 Location: Belgium Thanks: 291 times Was thanked: 955 time(s) in 790 post(s)
|
Originally Posted by: sojorner
Script 1: API.Function("Merge",Duration:=2000,Input:=4) API.Function("SetDynamicInput1",4)
Script 2: API.Function("NextPicture",Dynamic1)
The 'Dynamic1' set as the value for the NextPicture Function is where I get the "not declared" error message.
Not sure what I'm doing wrong. Thanks in advance.
Would be more successful if the functions were written correctly. Where are the Value specifics? where are the Input Specifics ? As dmwkr mentioned : See Scripting for Dummies post for examples. more specifically post #80
|
1 user thanked doggy for this useful post.
|
|
|
Rank: Member
Groups: Registered
Joined: 8/17/2020(UTC) Posts: 13 Location: York Thanks: 3 times
|
dmwkr: Thanks. I had looked at them and not being a programmer, found them a little intimidating. However, I plugged through them, but had to find the command for getting the current active input. Once I got that, it worked like a charm. I was really hoping that a simple line referring to the DynamicINput would have worked. Apparently they don't. :(
Here is the final code for the 2nd script:
CODE:
Dim doc As New XmlDocument() doc.LoadXml(API.Xml) Dim root As XmlNode = doc.DocumentElement
' Select the node active input and fetch input number Dim node As XmlNode = root.SelectSingleNode("/vmix/active") Dim activeNumber as Integer = node.InnerXml Console.WriteLine("Current Active Output is "& activenumber) 'this was inserted to initially test API.Function("NextPicture",activenumber)
End of Code.
The one thing I'm not sure of is where does the "Console Write" appear when completed? Is it only in the area below the script list, or does it also show up somewhere else?
Thanks
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,218 Location: Belgium Thanks: 291 times Was thanked: 955 time(s) in 790 post(s)
|
Originally Posted by: sojorner I was really hoping that a simple line referring to the DynamicINput would have worked. Apparently they don't. :(
There is !Quote:The one thing I'm not sure of is where does the "Console Write" appear when completed? Is it only in the area below the script list, Yes, more intended for testing/debugging purposes
|
2 users thanked doggy for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 2/23/2019(UTC) Posts: 556
Thanks: 62 times Was thanked: 130 time(s) in 118 post(s)
|
|
1 user thanked dmwkr for this useful post.
|
|
|
Rank: Member
Groups: Registered
Joined: 8/17/2020(UTC) Posts: 13 Location: York Thanks: 3 times
|
Thanks. I saw that from Doggy, but couldn't make it work. What I used is working great for me, so I will continue. BY the way I had seen what you recommended previously, hadn't walked through it, as I really did not want to get into any heavy VB/xml programming. I also watched the YouTube video on VMIX Scripting - Part2, while not completely over my head, just seemed more than what I wanted to (spend the time learning it right now) and really thought there would be a simpler way. But thank you for the input and, it actually drove me to study the script a little more! :)
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,218 Location: Belgium Thanks: 291 times Was thanked: 955 time(s) in 790 post(s)
|
Originally Posted by: sojorner Thanks. I saw that from Doggy, but couldn't make it work. What I used is working great for me, so I will continue. BY the way I had seen what you recommended previously, hadn't walked through it, as I really did not want to get into any heavy VB/xml programming. I also watched the YouTube video on VMIX Scripting - Part2, while not completely over my head, just seemed more than what I wanted to (spend the time learning it right now) and really thought there would be a simpler way. But thank you for the input and, it actually drove me to study the script a little more! :) sigh Code:API.Function("SetDynamicInput1",Value:="4")
API.Function("NextPicture",Input:="Dynamic1")
Originally Posted by: dmwkr Sorry, I was actually wrong.
Not wrong, just another option ;-)
|
1 user thanked doggy for this useful post.
|
|
|
Rank: Member
Groups: Registered
Joined: 8/17/2020(UTC) Posts: 13 Location: York Thanks: 3 times
|
Thank you!! Worked like a charm!! :)
It appears that my original error was that I didn't have quotes around the input value - Dynamic1. So now I'm curious. When I use an API function that requires an input, I've been able to use it without quotes on the input. I haven't been able to find any documentation that shows you need to put quotes around an input value. Is it because Dynamic1 is treated as a variable as opposed to a fixed value? Thanks
|
|
|
|
vMix Forums
»
General
»
General Discussion
»
Scripting: I'd like to pass a Dynamic Input value from one script to another
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