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
sojorner  
#1 Posted : Sunday, March 13, 2022 7:44:30 AM(UTC)
sojorner

Rank: Member

Groups: Registered
Joined: 8/17/2020(UTC)
Posts: 13
United States
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.
dmwkr  
#2 Posted : Sunday, March 13, 2022 7:56:43 AM(UTC)
dmwkr

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.
doggy  
#3 Posted : Sunday, March 13, 2022 8:27:44 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,218
Belgium
Location: Belgium

Thanks: 291 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: sojorner Go to Quoted Post


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
thanks 1 user thanked doggy for this useful post.
dmwkr on 3/13/2022(UTC)
sojorner  
#4 Posted : Sunday, March 13, 2022 8:31:42 AM(UTC)
sojorner

Rank: Member

Groups: Registered
Joined: 8/17/2020(UTC)
Posts: 13
United States
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
doggy  
#5 Posted : Sunday, March 13, 2022 8:38:14 AM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,218
Belgium
Location: Belgium

Thanks: 291 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: sojorner Go to Quoted Post
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
thanks 2 users thanked doggy for this useful post.
dmwkr on 3/13/2022(UTC), sojorner on 3/13/2022(UTC)
dmwkr  
#6 Posted : Sunday, March 13, 2022 10:33:11 AM(UTC)
dmwkr

Rank: Advanced Member

Groups: Registered
Joined: 2/23/2019(UTC)
Posts: 556

Thanks: 62 times
Was thanked: 130 time(s) in 118 post(s)
Sorry, I was actually wrong. Look at what doggy said:

https://forums.vmix.com/...ng-for-Dummies#post88552
thanks 1 user thanked dmwkr for this useful post.
sojorner on 3/13/2022(UTC)
sojorner  
#7 Posted : Sunday, March 13, 2022 2:50:11 PM(UTC)
sojorner

Rank: Member

Groups: Registered
Joined: 8/17/2020(UTC)
Posts: 13
United States
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! :)
doggy  
#8 Posted : Sunday, March 13, 2022 4:28:24 PM(UTC)
doggy

Rank: Advanced Member

Groups: Registered
Joined: 12/27/2012(UTC)
Posts: 5,218
Belgium
Location: Belgium

Thanks: 291 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: sojorner Go to Quoted Post
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 Go to Quoted Post
Sorry, I was actually wrong.



Not wrong, just another option ;-)
thanks 1 user thanked doggy for this useful post.
sojorner on 3/13/2022(UTC)
sojorner  
#9 Posted : Sunday, March 13, 2022 10:25:33 PM(UTC)
sojorner

Rank: Member

Groups: Registered
Joined: 8/17/2020(UTC)
Posts: 13
United States
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
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.