vMix Forums
»
General
»
General Discussion
»
Get recording time when a text value changes
Rank: Newbie
Groups: Registered
Joined: 6/9/2023(UTC) Posts: 3 Location: Antwerp Thanks: 1 times
|
Hi everyone,
I'm very new to scripting for vMix (and scripting in general).
I'm looking for a script that writes the current recordingtime to a text document (or logfile) whenever a certain text value changes. And it would be even better if it also writes the new text value next to the recordingtime.
I allready tried this: Function=WriteDurationToRecordingLog&Input=brugge-agendapunten.gtzip&Value=&SelectedName=TextBlock1.Text&Index=0
But i don't know what the Value should be...
Many thanks in regards.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/24/2021(UTC) Posts: 547 Location: athens Thanks: 130 times Was thanked: 74 time(s) in 70 post(s)
|
Originally Posted by: JasperHendrickx Hi everyone,
I'm very new to scripting for vMix (and scripting in general).
I'm looking for a script that writes the current recordingtime to a text document (or logfile) whenever a certain text value changes. And it would be even better if it also writes the new text value next to the recordingtime.
I allready tried this: Function=WriteDurationToRecordingLog&Input=brugge-agendapunten.gtzip&Value=&SelectedName=TextBlock1.Text&Index=0
But i don't know what the Value should be...
Many thanks in regards. Hello based in this script https://forums.vmix.com/...or-commercials#post99914 i modified it to make something that may fit what you need Code:
' Script von Mats Julian Steffens
' www.lvstrm.de
Dim dateinamealt As String = ""
Dim startTime As DateTime = DateTime.Now
Dim previousText As String = ""
Dim currentText As String = ""
Do
Dim datum As String
datum = DateTime.Now.ToString("yyMMdd")
Dim filename As String
filename = "C:\vMix log\" + datum + "-vmixlog.txt"
If (Not System.IO.File.Exists(filename)) Then
My.Computer.FileSystem.WriteAllText(filename, " ", True)
End If
Dim timestamp As DateTime
timestamp = DateTime.Now
' Ανακτήστε το XML από το VMix API
Dim xml As String = API.XML()
Dim x As New System.Xml.XmlDocument
x.LoadXml(xml)
Dim activinput As String = (x.SelectSingleNode("/vmix/active").InnerText)
Dim inputname As String = (x.SelectSingleNode("//input[@number=" + activinput + "]/@shortTitle").Value)
Dim dateiname As String = (x.SelectSingleNode("//input[@number=" + activinput + "]/@title").Value)
Dim currentTextElement As System.Xml.XmlNode = x.SelectSingleNode("//text[@index='0' and @name='rectext.Text']")
Dim inputnamelaenge As Integer
If (inputname = dateiname) Then
inputnamelaenge = 0
Else
inputnamelaenge = inputname.Length() + 3
End If
Dim inputString As String
' Γράψτε το αρχείο
If (dateinamealt <> dateiname) Then
Dim elapsedTime As TimeSpan = timestamp - startTime
Dim duration As String = String.Format("{0:mm':'ss}", elapsedTime)
inputString = timestamp.ToString("dd/MM/yy HH:mm:ss") + " " + duration + " " + dateiname.Substring(inputnamelaenge) + " " + currentText + Environment.NewLine
Console.WriteLine(inputString)
My.Computer.FileSystem.WriteAllText(filename, inputString, True)
dateinamealt = dateiname
End If
' Έλεγχος αν το κείμενο έχει αλλάξει
If currentTextElement IsNot Nothing Then
currentText = currentTextElement.InnerText
Else
currentText = ""
End If
If currentText <> previousText Then
Dim elapsedTime As TimeSpan = timestamp - startTime
Dim duration As String = String.Format("{0:mm':'ss}", elapsedTime)
inputString = timestamp.ToString("dd/MM/yy HH:mm:ss") + " " + duration + " " + dateiname.Substring(inputnamelaenge) + " " + currentText + Environment.NewLine
Console.WriteLine(inputString)
My.Computer.FileSystem.WriteAllText(filename, inputString, True)
previousText = currentText
End If
Sleep(1000)
Loop
Make a folder in C:\Vmix log. Start this script same time you start record and in the folder will be created a txt file that will be like this 09/06/23 22:59:50 00:00:00.0019946 NDI DESKTOP-OJV2PL8 (vMix - Output 1) Hello 09/06/23 23:00:09 00:00:19.0321253 NDI DESKTOP-OJV2PL8 (vMix - Output 1) ΒΥΕ 09/06/23 23:00:10 00:00:20.0332841 NDI DESKTOP-OJV2PL8 (vMix - Output 1) GOOD 09/06/23 23:00:21 00:00:31.0460639 NDI DESKTOP-OJV2PL8 (vMix - Output 1) NIGHT 09/06/23 23:00:22 00:00:32.0473666 NDI DESKTOP-OJV2PL8 (vMix - Output 1) NIGHT 09/06/23 23:00:23 00:00:33.0489171 NDI DESKTOP-OJV2PL8 (vMix - Output 1) NIGHT 09/06/23 23:00:32 00:00:42.0583673 NDI DESKTOP-OJV2PL8 (vMix - Output 1) VMIX 09/06/23 23:00:33 00:00:43.0599807 NDI DESKTOP-OJV2PL8 (vMix - Output 1) MORNING Ιn which lines we have the date-time,the active source and from when we start script/record and starting from 0 in which point of record the text changed Also to be able the script know when the text changes i picked up a random title from vmix templates, open it to gt designer and i changed the layer name from Headline.text to rectext.text. So in vmix api xml is created when we use the title we modified an entry that is like <text index="0" name="rectext.Text">MORNING</text> in order the script must know where to look for. This line can be changed in whatever you want by changing this line in code script Code:
Dim currentTextElement As System.Xml.XmlNode = x.SelectSingleNode("//text[@index='0' and @name='rectext.Text']")
make a title with the name layer you want and change it to script also and modify it by your needs. I hope that this, helps you
|
1 user thanked nikosman88 for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 12/27/2012(UTC) Posts: 5,249 Location: Belgium Thanks: 294 times Was thanked: 961 time(s) in 795 post(s)
|
Originally Posted by: nikosman88 Originally Posted by: JasperHendrickx
I'm looking for a script that writes the current recordingtime to a text document (or logfile) whenever a certain text value changes. And it would be even better if it also writes the new text value next to the recordingtime.
Hello based in this script https://forums.vmix.com/...or-commercials#post99914 i modified it to make something that may fit what you need Why are you using the datetime when the question was for the current recording time that can be retrieved strait from the API XML ? The text in the title can more easely be retrieved with the input.find() function
|
|
|
|
vMix Forums
»
General
»
General Discussion
»
Get recording time when a text value changes
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