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
fideba  
#1 Posted : Wednesday, July 20, 2022 12:10:56 AM(UTC)
fideba

Rank: Member

Groups: Registered
Joined: 11/5/2021(UTC)
Posts: 16
Belgium

Thanks: 2 times
Ok, here goes for without any doubt a stupid question, but I can't seem to find the answer :-)
I have a text input, which I will use for live subtitling. I want to increase the Description.Text index with one, on each keypress. I've used the "settext" function on the Title, which works fine if I specify a fixed number. But I want to increase that number with each keypress.
I've been playing with DynamicValues, and that works fine also, if I assign a fixed number manually to DynamicValue1, and then assign DynamicValue1 to my description.text using Settext. However, I simply can't seem to figure out how I can increase DynamicValue1 with a keypress.
I've been playing with webscripts, vbscripts, just entering DynamicValue1+=1 or DynamicValue1=DynamicValue1+1, but that just replaces the value of DynamicValue with a string, and doesn't increase the number. I must be overlooking something really simple.

So basically my question is: suppose I have DynamicValue1 with a value of 2, how do I, with a keypress, makes sure that it contains the value 3...

Thanks a lot, it's driving my crazy ;-)

doggy  
#2 Posted : Wednesday, July 20, 2022 1:24:58 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)
Few lines of code in vMix scripting
Read the content of the DynamicValue1 from the API XML, convert to value and add 1 and do a SetDynamic1 with the new value (tostring).
The shortcut calls the script
fideba  
#3 Posted : Wednesday, July 20, 2022 1:28:21 AM(UTC)
fideba

Rank: Member

Groups: Registered
Joined: 11/5/2021(UTC)
Posts: 16
Belgium

Thanks: 2 times
Originally Posted by: doggy Go to Quoted Post
Few lines of code in vMix scripting
Read the content of the DynamicValue1 from the API XML, convert to value and add 1 and do a SetDynamic1 with the new value (tostring).
The shortcut calls the script


Yep, I seemed to be stuck on the "read the content". It was quite a bit more complex then I thought, but I've got it working, thanks !

For people interested:

dim Dynamic1Val as Integer= 1

dim VmixXML as new system.xml.xmldocument

VmixXML.loadxml(API.XML)

dim Dynamic1Node As XmlNode = VmixXML.selectSingleNode("/vmix/dynamic/value1")

Dynamic1Val = Dynamic1Node.InnerText
Dynamic1Val+=1

API.Function("SetDynamicValue1", Value:=Dynamic1Val)
doggy  
#4 Posted : Wednesday, July 20, 2022 1:32:52 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: fideba Go to Quoted Post

I have a text input, which I will use for live subtitling. I want to increase the Description.Text index with one, on each keypress. I've used the "settext" function on the Title, which works fine if I


Still confused though in regards to the "index"

want to increase the nummer displayed in the text field ?
Its content has to start with a value ( say 0) then just do a SetText of that field with a +=1 as value

BTW code to read API XML has been posted numerous times (see scripting for dummies post)
And if one wants to post code please use the language syntax highlighting to quote it

Code:
dim Dynamic1Val as Integer= 1

dim VmixXML as new system.xml.xmldocument

VmixXML.loadxml(API.XML)

dim Dynamic1Node As XmlNode = VmixXML.selectSingleNode("/vmix/dynamic/value1")

Dynamic1Val = Dynamic1Node.InnerText
Dynamic1Val+=1

API.Function("SetDynamicValue1", Value:=Dynamic1Val)
Users browsing this topic
Guest (3)
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.