logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

27 Pages«<252627
Options
Go to last post Go to first unread
doggy  
#521 Posted : Saturday, December 28, 2024 9:20:44 PM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 314 times
Was thanked: 1017 time(s) in 835 post(s)
Display remaining time of a list playout on a title ( for shits and giggles)

in response to https://forums.vmix.com/...ing-countdown#post116907

Code:
'Get the total duration of a List script by Doggy

'assuming the first item in that list is selected !!!
'playout is set to Auto Next and Auto First !!!
'Things that ight offset the time between countdown and play are transitions used for the list

Dim listInput as integer = 3   'input number of list
Dim titleInp as integer = 5    'input number of title
Dim textIndex as Integer = 0   ' textfield to set countdown 

' Takes a while to Process , depending on number of items in the list !!

dim xml as string = API.XML()
dim x as new system.xml.xmldocument
x.loadxml(API.XML())

Dim nodeList As XmlNodeList = x.SelectNodes("//list/item")
dim count as integer = nodeList.count() 
dim selected as string
dim duration as integer

' if first item is not selected add a routine here to do so 

' skip to each item in list to get the duration and tally up
for i as integer = 0 to count-1
  x.loadxml(API.XML())
  nodeList = x.SelectNodes("//list/item")
  duration += x.SelectSingleNode("//input[@number='3']/@duration").Value
  API.Function("NextItem", Input:=3)
  sleep(300)
next

' Convert ms the time 
Dim ts as Timespan= TimeSpan.FromMilliseconds(duration )
Sleep(300)


'Optional
'setting countdown and starting list playback and Countdown

API.Function("StopCountDown", Input:=titleInp ,SelectedIndex:=textIndex )
sleep(100)
API.Function("SetCountDown", Input:=titleInp ,SelectedIndex:=textIndex ,Value:= ts.ToString("hh\:mm\:ss"))
API.Function("ListPlayout",Input:=listInput)
sleep(500)  'adjusting for function calls time
Api.Function("StartCountdown",Input:=titleInp )
API.Function("OverlayInput1In",Input:=titleInp )

'Can add triggers on CountdownCompleted to remove overlay and make a transition 


thanks 1 user thanked doggy for this useful post.
nikosman88 on 12/28/2024(UTC)
NicholasLowFK  
#522 Posted : Thursday, January 2, 2025 6:46:24 PM(UTC)
NicholasLowFK

Rank: Newbie

Groups: Registered
Joined: 1/2/2025(UTC)
Posts: 2
Malaysia
Location: Kuala Lumpur

hi guys,
i have a problem with my scripting, i wish to get my recording status for my following action, for instance, when i toggle my script, if recording status is active i would like to have my title transition out and stop my recording, whereby if recording was not active upon toggling the script i would like to have my recording active and transition in for my title, is it possible?
doggy  
#523 Posted : Thursday, January 2, 2025 7:22:22 PM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 314 times
Was thanked: 1017 time(s) in 835 post(s)
Originally Posted by: NicholasLowFK Go to Quoted Post
hi guys,
i have a problem with my scripting, i wish to get my recording status for my following action, for instance, when i toggle my script, if recording status is active i would like to have my title transition out and stop my recording, whereby if recording was not active upon toggling the script i would like to have my recording active and transition in for my title, is it possible?


Sure it can , what have you tried so far (can post it here) ? (as there are meny examples in this thread)









https://forums.vmix.com/...ng-for-Dummies#post71124
doggy  
#524 Posted : Friday, February 7, 2025 8:39:23 PM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 314 times
Was thanked: 1017 time(s) in 835 post(s)
Duration, position and time remaining of current playing clip of List

Code:
' timeleft clip in list

dim position as string = ""
dim duration as string = ""
dim activeinput as string = ""

dim pos as decimal=0
dim dur as decimal =0
dim Timeleft as decimal = 0

do while true
   dim xml as string = API.XML()
   dim x as new system.xml.xmldocument
   x.loadxml(xml)

   activeinput = (x.SelectSingleNode("//active").InnerText)

   if activeinput = "3"  ' the # of list input

      duration = (x.SelectSingleNode("//input[@number='"& activeinput &"']/@duration").Value)/1000
      position = (x.SelectSingleNode("//input[@number='"& activeinput &"']/@position").Value)/1000

      if decimal.TryParse(duration ,dur) then
               dur = Math.Truncate(dur)
      end if

      if decimal.TryParse(position ,pos) then
               pos = Math.Truncate(pos)
      end if
      Timeleft = Math.Truncate(dur - pos)
    
    ' display in title input 4 first Textfield duration/position/time remaining
    API.Function("SetText",Input:="4",SelectedIndex:="0",Value:=dur.tostring() & " / " &  pos.tostring() & " / " & Timeleft.tostring())
  
  end if
  sleep(100)
loop
AngusFindlay  
#525 Posted : Friday, June 13, 2025 3:24:54 AM(UTC)
AngusFindlay

Rank: Member

Groups: Registered
Joined: 8/24/2018(UTC)
Posts: 24
Location: Canada

Thanks: 14 times
Originally Posted by: Xtreemtec Media Go to Quoted Post
So based on 2 programs above from Doggy,

I made a Video player time left title display that you can add on top of the Clock source by using the Multiview to stack upon.

While the code is not 100% perfect yet and only displays MM;SS But it gives you some idea and it's workable.

Till 60 seconds it's green, Turns then orange, and the last 10 seconds it's red.


I've updated the script to always display the minutes. Thanks to the original poster for their work!

Code:

' Checking time left of active running video and display this as an title. 
' and do some stuff at certain time remaining

dim position as string = ""
dim duration as string = ""
dim activeinput as string = ""
dim Timeleft as double = 0
dim triggertime as integer = 10      '10 seconds before end
dim triggerduration as integer = 2000   'fade duration, could be different than trigger

do while true

   dim xml as string = API.XML()
   dim x as new system.xml.xmldocument
   x.loadxml(xml)

activeinput = (x.SelectSingleNode("//active").InnerText)
duration = (x.SelectSingleNode("//input[@number='"& activeinput &"']/@duration").Value)
position = (x.SelectSingleNode("//input[@number='"& activeinput &"']/@position").Value)

Timeleft= Double.Parse(duration)-Double.Parse(position)

Timeleft = Timeleft / 100

dim Timingleft as integer = CInt(Timeleft)
Timingleft = Timingleft / 10

dim Minutes as integer = Timingleft \ 60
dim Seconds as integer = Timingleft Mod 60

'used at debugging stage
  ' console.writeline(Timingleft)
  ' console.writeline(Seconds)

dim ThisTime as string 
ThisTime = Minutes.ToString("00") + ":" + Seconds.ToString("00")
API.Function("SetText",Input:="Text Middle Centre Outline.gtzip",SelectedIndex:="0" ,Value:=ThisTime)


if Timingleft < 60
   'put a response in a title and change color accordingly
  
    if Timingleft < 30 
       API.Function("SetTextColour",Input:="Text Middle Centre Outline.gtzip",Value:="red")
    else
       API.Function("SetTextColour",Input:="Text Middle Centre Outline.gtzip",Value:="orange")
    end if  
else
    API.Function("SetTextColour",Input:="Text Middle Centre Outline.gtzip",Value:="green")
 end if


sleep(50)
Loop

Roy Sinclair  
#526 Posted : Friday, June 13, 2025 1:05:13 PM(UTC)
Roy Sinclair

Rank: Advanced Member

Groups: Registered
Joined: 11/23/2020(UTC)
Posts: 226
United States
Location: Wichita

Thanks: 11 times
Was thanked: 29 time(s) in 25 post(s)
Originally Posted by: AngusFindlay Go to Quoted Post
Originally Posted by: Xtreemtec Media Go to Quoted Post
So based on 2 programs above from Doggy,

I made a Video player time left title display that you can add on top of the Clock source by using the Multiview to stack upon.

While the code is not 100% perfect yet and only displays MM;SS But it gives you some idea and it's workable.

Till 60 seconds it's green, Turns then orange, and the last 10 seconds it's red.


I've updated the script to always display the minutes. Thanks to the original poster for their work!

Code:

' Checking time left of active running video and display this as an title. 
' and do some stuff at certain time remaining

dim position as string = ""
dim duration as string = ""
dim activeinput as string = ""
dim Timeleft as double = 0
dim triggertime as integer = 10      '10 seconds before end
dim triggerduration as integer = 2000   'fade duration, could be different than trigger

do while true

   dim xml as string = API.XML()
   dim x as new system.xml.xmldocument
   x.loadxml(xml)

activeinput = (x.SelectSingleNode("//active").InnerText)
duration = (x.SelectSingleNode("//input[@number='"& activeinput &"']/@duration").Value)
position = (x.SelectSingleNode("//input[@number='"& activeinput &"']/@position").Value)

Timeleft= Double.Parse(duration)-Double.Parse(position)

Timeleft = Timeleft / 100

dim Timingleft as integer = CInt(Timeleft)
Timingleft = Timingleft / 10

dim Minutes as integer = Timingleft \ 60
dim Seconds as integer = Timingleft Mod 60

'used at debugging stage
  ' console.writeline(Timingleft)
  ' console.writeline(Seconds)

dim ThisTime as string 
ThisTime = Minutes.ToString("00") + ":" + Seconds.ToString("00")
API.Function("SetText",Input:="Text Middle Centre Outline.gtzip",SelectedIndex:="0" ,Value:=ThisTime)


if Timingleft < 60
   'put a response in a title and change color accordingly
  
    if Timingleft < 30 
       API.Function("SetTextColour",Input:="Text Middle Centre Outline.gtzip",Value:="red")
    else
       API.Function("SetTextColour",Input:="Text Middle Centre Outline.gtzip",Value:="orange")
    end if  
else
    API.Function("SetTextColour",Input:="Text Middle Centre Outline.gtzip",Value:="green")
 end if


sleep(50)
Loop




I see a major problem with this script. You have NO provision to exit the script when the video ends, it just loops FOREVER which means the script can't be started for another video and of course is consuming resources long after it's actual job has been done and in fact until it's force stopped or vMix is shut down.

All you need do to fix it is change the initial value of TimeLeft to 1.0 and then change the Do While statement to "Do While TimeLeft > 0.0".

A second problem is the "sleep(50)", for each second of time that passes this loop will execute 20 times. That's at least twice as often as it needs to run, try setting it to "sleep(300)" and see if it isn't updating regularly enough to be indistinguishable from the "sleep (50)" version.

Still you have provided what several have asked for and since the problems are easily solved I say you've done good!


AngusFindlay  
#527 Posted : Tuesday, June 17, 2025 1:18:05 AM(UTC)
AngusFindlay

Rank: Member

Groups: Registered
Joined: 8/24/2018(UTC)
Posts: 24
Location: Canada

Thanks: 14 times
The 20-times-per-second frequency was a choice by the original poster of the script. I've updated it to sleep(200) in my own instance, and of course, it still works just fine at 5 updates per second.

As for the script running all the time, that's on purpose, and how I prefer it. I do lots of work with video playback in vMix, so I don't want to have to put a trigger on every video to start the script. With it written this way, I can start the script once using a browser input to call the script start command, and then it's available for every video, regardless of prior preparation.

Thanks for your feedback!
Roy Sinclair  
#528 Posted : Tuesday, June 17, 2025 1:55:54 AM(UTC)
Roy Sinclair

Rank: Advanced Member

Groups: Registered
Joined: 11/23/2020(UTC)
Posts: 226
United States
Location: Wichita

Thanks: 11 times
Was thanked: 29 time(s) in 25 post(s)
Originally Posted by: AngusFindlay Go to Quoted Post
The 20-times-per-second frequency was a choice by the original poster of the script. I've updated it to sleep(200) in my own instance, and of course, it still works just fine at 5 updates per second.

As for the script running all the time, that's on purpose, and how I prefer it. I do lots of work with video playback in vMix, so I don't want to have to put a trigger on every video to start the script. With it written this way, I can start the script once using a browser input to call the script start command, and then it's available for every video, regardless of prior preparation.

Thanks for your feedback!


Ah, I see, that's pretty clever in fact.
gorbva  
#529 Posted : Thursday, June 19, 2025 6:55:45 PM(UTC)
gorbva

Rank: Member

Groups: Registered
Joined: 12/4/2019(UTC)
Posts: 25
Kazakhstan

Was thanked: 1 time(s) in 1 post(s)
Hi guys!
How can i debug vMix scripts in Visual Studio Code? I mean full featured debug with breakpoints, step-by-step and variable-watch debug.
How do you debug your bulky scripts? WriteLn only?
Roy Sinclair  
#530 Posted : Thursday, September 18, 2025 7:54:06 AM(UTC)
Roy Sinclair

Rank: Advanced Member

Groups: Registered
Joined: 11/23/2020(UTC)
Posts: 226
United States
Location: Wichita

Thanks: 11 times
Was thanked: 29 time(s) in 25 post(s)
Originally Posted by: gorbva Go to Quoted Post
Hi guys!
How can i debug vMix scripts in Visual Studio Code? I mean full featured debug with breakpoints, step-by-step and variable-watch debug.
How do you debug your bulky scripts? WriteLn only?


I'm sure you've figured it out by now but "console.writeline" for the radically crippled internal scripting or you create an external program that uses the API via HTTP calls and then you can use the full features of your development environment AND use the language of your choice with all of it's features.
TL68  
#531 Posted : Wednesday, February 18, 2026 6:47:43 PM(UTC)
TL68

Rank: Advanced Member

Groups: Registered
Joined: 12/8/2022(UTC)
Posts: 126
Sweden

Thanks: 37 times
Was thanked: 2 time(s) in 2 post(s)
Hi!
I am another one of those beyond Dummies guys who needs some help with scripting for vMix. Bear with me :-).
And in all this: I do not know how to code. But I can try to learn if it is needed to solve my problem. If the problem can be solved with a script. Or maybe some kind member can help me out.

First: here is what I would like to achieve.
In a Google sheets we use as a datasource for changing texts and images in vMix GT-titles, we would also like to change a vMix video input which are used for running a intro at the start of our broadcasts. This change is done by choosing filenames (and maybe filepaths) in a droptown menu in a cell in sheets.
We need the input in vmix to be the same since we want to use the same intro shortcut to run the intro video after it has been updated from the sheets.

But apparently there is no way to connect a video input to a datasource to change filepaths and names in the way you can do with images, texts and colors in GT titles.

Script solution possible?
Looking through this thread, some other forum posts and the api function list I get the impression this maybe can be solved by using a List input instead with a script that does something like this:

1. The cell in the sheets datasource is updated with a new video file and file path
2. A "hidden" GT title input is used as a placeholder updates a text with the filename and path
3. The script starts with reading the textfrom the title
4. The script then replaces the current video in a List input with the video which is collected from the GT title input

Is the above possible to achieve with a script?

And as said above: if anyone can help me code it I would be very, very grateful. Maybe this could help others too. Seems as if this workflow has been asked for by others in the forums before me.

Cheers!
T


doggy  
#532 Posted : Wednesday, February 18, 2026 8:03:20 PM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 314 times
Was thanked: 1017 time(s) in 835 post(s)
Originally Posted by: TL68 Go to Quoted Post
Hi!
I am another one of those beyond Dummies guys who needs some help with scripting for vMix. Bear with me :-).
And in all this: I do not know how to code. But I can try to learn if it is needed to solve my problem. If the problem can be solved with a script. Or maybe some kind member can help me out.

First: here is what I would like to achieve.
In a Google sheets we use as a datasource for changing texts and images in vMix GT-titles, we would also like to change a vMix video input which are used for running a intro at the start of our broadcasts. This change is done by choosing filenames (and maybe filepaths) in a droptown menu in a cell in sheets.
We need the input in vmix to be the same since we want to use the same intro shortcut to run the intro video after it has been updated from the sheets.

But apparently there is no way to connect a video input to a datasource to change filepaths and names in the way you can do with images, texts and colors in GT titles.

Script solution possible?
Looking through this thread, some other forum posts and the api function list I get the impression this maybe can be solved by using a List input instead with a script that does something like this:

1. The cell in the sheets datasource is updated with a new video file and file path
2. A "hidden" GT title input is used as a placeholder updates a text with the filename and path
3. The script starts with reading the textfrom the title
4. The script then replaces the current video in a List input with the video which is collected from the GT title input

Is the above possible to achieve with a script?

And as said above: if anyone can help me code it I would be very, very grateful. Maybe this could help others too. Seems as if this workflow has been asked for by others in the forums before me.

Cheers!
T




All in one script when called

Add a video input based on the link provided by the datasource (retrieved from hidden text field in your title)
Rename that added input (select it based on the filename) to say "Intro"

Your call shortcut will be based on the newly given specific name


Might be best to first deleted a previous input called "Intro"
in your script check if the video is actually changed to avoid unnecessary changes/adding inputs

Disclaimer: not fully tested but is based on available shortcuts/api functions. will have to be scripted in vb.net
thanks 1 user thanked doggy for this useful post.
TL68 on 2/19/2026(UTC)
TL68  
#533 Posted : Thursday, February 19, 2026 2:23:08 AM(UTC)
TL68

Rank: Advanced Member

Groups: Registered
Joined: 12/8/2022(UTC)
Posts: 126
Sweden

Thanks: 37 times
Was thanked: 2 time(s) in 2 post(s)
Thanks for helping out Doggy!
Based on your input and a loooot of back and forth with Chat GPT I think I got a script that seems to work. A bit cheating maybe... but hey what can a man do.
Yey!

Will post it here after some more testing.
Roy Sinclair  
#534 Posted : Thursday, February 19, 2026 8:13:06 AM(UTC)
Roy Sinclair

Rank: Advanced Member

Groups: Registered
Joined: 11/23/2020(UTC)
Posts: 226
United States
Location: Wichita

Thanks: 11 times
Was thanked: 29 time(s) in 25 post(s)
Originally Posted by: TL68 Go to Quoted Post
Thanks for helping out Doggy!
Based on your input and a loooot of back and forth with Chat GPT I think I got a script that seems to work. A bit cheating maybe... but hey what can a man do.
Yey!

Will post it here after some more testing.


ChatGPT might be able to do that BUT it has to be told that the version of vbscript it writes cannot contain any functions, vMix supports calling existing functions but does not allow you to add any functions within the code that you write. The code needs to be pure top down style.
TL68  
#535 Posted : Thursday, February 19, 2026 5:31:39 PM(UTC)
TL68

Rank: Advanced Member

Groups: Registered
Joined: 12/8/2022(UTC)
Posts: 126
Sweden

Thanks: 37 times
Was thanked: 2 time(s) in 2 post(s)
Originally Posted by: Roy Sinclair Go to Quoted Post
Originally Posted by: TL68 Go to Quoted Post
Thanks for helping out Doggy!
Based on your input and a loooot of back and forth with Chat GPT I think I got a script that seems to work. A bit cheating maybe... but hey what can a man do.
Yey!

Will post it here after some more testing.


ChatGPT might be able to do that BUT it has to be told that the version of vbscript it writes cannot contain any functions, vMix supports calling existing functions but does not allow you to add any functions within the code that you write. The code needs to be pure top down style.


Yes I (or chat gpt) noticed this. This was one reason for a lot of the back and forth. Chat GTP seems to know/learn that vbscript in vMix needs to be written in a specific way. But we got it finally :-) /T
TL68  
#536 Posted : Thursday, February 19, 2026 6:32:25 PM(UTC)
TL68

Rank: Advanced Member

Groups: Registered
Joined: 12/8/2022(UTC)
Posts: 126
Sweden

Thanks: 37 times
Was thanked: 2 time(s) in 2 post(s)
Hi!
Here is the script I - and ChatGPT- ended up with to be able to change a video intro in vMix, using filenames and filepath from a data source. In this case a Google Sheets.
The basic set up is:

- Google sheets: a cell is populated with the filepath to an intro video stored on the same computer as vMix runs on.
- vMix: a data source reads the sheet doc in i normal data source setup
- vMix: a GT Title is created called "video_sokvagar" (swedish for "video_paths"). This title is only used to collect the file paths from the data source. It is not displayed.
- vMix: a object in the Title called "intro.Text" is updated with the video paths from the data source
- vMix: a list input called "intro_list" is populated with the default intro video

Script function (taken from Chat GPT description) :
When the script runs it checks the filepath in the Title input and if it has changed from the data source it replaces the video in the list input with the new filepath.

I hade another working script which instead of replacing the video in the list input, created a new video input everytime there was a new videopath in the title.
I worked too but every time the new video input was created of course triggers and other specific settings on the previous video was gone.
So in my usecase using a list input works much better.

Here is the script which seems to work fine for me.
Disclaimer: ALL coding is done by Chat GPT. I have no clue if it is good or not :-).

But I am posting it here so maybe others who need to be able to change videos from a data source can benefit from it.

Cheers!
/T


Code:

' ===== SETTINGS =====
Dim titleInputName As String = "video_sokvagar"      ' Title input
Dim textFieldName As String = "intro.Text"           ' Text field in Title
Dim listInputName As String = "intro_list"           ' Existing List input
Dim savedPathVariable As String = "SenasteIntroVag"  ' Variable storing last path
' ==========================

' Load vMix XML
Dim xml As String = API.XML
Dim doc As New System.Xml.XmlDocument()
doc.LoadXml(xml)

' ===== READ PATH FROM TITLE =====
Dim currentPath As String = ""
Dim inputs As XmlNodeList = doc.SelectNodes("//input")

For Each inputNode As XmlNode In inputs
    If inputNode.Attributes("title") IsNot Nothing AndAlso inputNode.Attributes("title").Value = titleInputName Then
        For Each textNode As XmlNode In inputNode.ChildNodes
            If textNode.Name = "text" Then
                Dim nameAttr As XmlAttribute = textNode.Attributes("name")
                If nameAttr IsNot Nothing AndAlso nameAttr.Value = textFieldName Then
                    currentPath = textNode.InnerText.Trim()
                End If
            End If
        Next
    End If
Next

If currentPath = "" Then
    Console.WriteLine("No path found in Title.")
    Return
End If

' ===== CHECK IF PATH CHANGED =====
Dim savedNode As XmlNode = doc.SelectSingleNode("//variable[@name='" & savedPathVariable & "']")
Dim previousPath As String = ""
If savedNode IsNot Nothing Then previousPath = savedNode.InnerText.Trim()

If previousPath = currentPath Then
    Console.WriteLine("Path unchanged. No update needed.")
    Return
End If

' ===== CHECK FILE EXISTS =====
If Not System.IO.File.Exists(currentPath) Then
    Console.WriteLine("File does not exist: " & currentPath)
    Return
End If

' ===== UPDATE LIST INPUT =====

' Stop list before modifying (safer)
API.Function("Pause", Input:=listInputName)

' Clear existing items in list
API.Function("ListRemoveAll", Input:=listInputName)

' Add new video to list
API.Function("ListAdd", Input:=listInputName, Value:=currentPath)

Console.WriteLine("List input updated with: " & currentPath)

' ===== SAVE PATH =====
API.Function("SetVariable", Value:=savedPathVariable & "=" & currentPath)


Search Keywords: update video from data source
doggy  
#537 Posted : Thursday, February 19, 2026 10:37:42 PM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 314 times
Was thanked: 1017 time(s) in 835 post(s)
Originally Posted by: TL68 Go to Quoted Post
Hi!
Here is the script I - and ChatGPT- ended up with to be able to change a video intro in vMix, using filenames and filepath from a data source. In this case a Google Sheets.
The basic set up is:



Very Nice effort and good use of a list I didnt think about

Problem though is even ChatGTP get it wrong as at times it throws things at you that makes you believe it works.
For one it invents stuff too like API.Function("SetVariable" does not work as this function doesnt even existsin vMix
Either the script will throw an error and crash or it will be ignored

Because you call the script only once when you decide for a change and the command is the last line of your script you didnt notice the error. if this script was set in a loop (constantly checking)than it would be problematic

Did a quick rewrite with a loop so one can just let it run continuously? If you dont want that just delete the Do While - Loop lines and the sleep command

One point though with this script is there needs to be a video in the list to start of even if the video is not related to your production
The title used here holds 2 text fields so one can give your datasource a video name column and a path one so at leas some info instead of just paths


Code:
' ===== SETTINGS =====
Dim listInputName As String = "intro_list"           ' Existing List input
' ==========================

do while true

  'get video name and path from title that is lnked to datasource
  dim Vname as string = Input.Find("video_sokvagar.gtzip").Text("Name.Text")
  dim Vpath as string = Input.Find("video_sokvagar.gtzip").Text("Path.Text")

  If Vpath = "" Then
    Console.WriteLine("No path found in Title.")
  End If

  Console.WriteLine(Vname)
  Console.WriteLine(Vpath)

  dim xml as string = API.XML()
  dim x as new system.xml.xmldocument
  x.loadxml(xml)


  Try
   ' Get current intro video path
   dim CurrentListVideo AS string = x.SelectSingleNode("//input[@type='VideoList']//list/item").InnerText
   Console.WriteLine(CurrentListVideo)

   'Check if current video path is same as selected from dataosource and not empty
   If CurrentListVideo <> Vpath and Vpath <> ""
      Console.WriteLine("Different" )

      ' check if new path actually exist
      If Not System.IO.File.Exists(Vpath) Then
             Console.WriteLine("File does not exist: " & Vpath)
             Exit Try
      End If
      
      ' all is fine to change the video 
         
      ' Stop list before modifying (safer)
       API.Function("Pause", Input:=listInputName)

      ' Clear existing items in list
      API.Function("ListRemoveAll", Input:=listInputName)

      ' Add new video to list
      API.Function("ListAdd", Input:=listInputName, Value:=Vpath)

      Console.WriteLine("List input updated with: " & Vpath)

   else
     ' dont do anything as not changed
     Console.WriteLine("No Change or empty data" )
     Exit Try
   end if

  Catch ex As Exception
   Console.WriteLine("No Video in List" )

 End Try
 Sleep(2000)  'check for change frequency
Loop




As a bonus one could add a 3rd textfield to the title to write the info you now displaying the console to it as visual progress feedback
thanks 1 user thanked doggy for this useful post.
TL68 on 2/19/2026(UTC)
TL68  
#538 Posted : Thursday, February 19, 2026 11:04:22 PM(UTC)
TL68

Rank: Advanced Member

Groups: Registered
Joined: 12/8/2022(UTC)
Posts: 126
Sweden

Thanks: 37 times
Was thanked: 2 time(s) in 2 post(s)
Thanks again Doggy!
Will try your updated script in a day or two (not by my vMix computer atm)/T

PS
As you guessed I do not loop the script from chatgpt. Instead I run it from a button in companion when I want to display the list with the intro. I have a short 500ms delay between running the script and displaying the list and it seems to be enough for the script to finish and updating the list before showing it. You notice the delay but it is not critical.

But of course a looped script keeping the list updated at all times would be nicer :-)
TL68  
#539 Posted : Friday, February 20, 2026 5:57:54 PM(UTC)
TL68

Rank: Advanced Member

Groups: Registered
Joined: 12/8/2022(UTC)
Posts: 126
Sweden

Thanks: 37 times
Was thanked: 2 time(s) in 2 post(s)
When I run the script it does not update the list input.
The script prompts:
"No change or empty data"
"No path found"

It writes out the existing filepath for the video in the list

In the title I can see that Name.Text and Path.Text is updated from the datasource.

Note: the path will most often not be changed from the datasource. Only the name updates. Maybe the script sees no change in path and then do not update the name?
TL68  
#540 Posted : Friday, February 20, 2026 8:23:53 PM(UTC)
TL68

Rank: Advanced Member

Groups: Registered
Joined: 12/8/2022(UTC)
Posts: 126
Sweden

Thanks: 37 times
Was thanked: 2 time(s) in 2 post(s)
Ok, some findings:
1. in vmix I had renamed the Title so it did not have the ".gtzip" ending.
Correcting this in the script made it read the title but it did not update the list.

But when I put both filepath and filename in path cell i Sheets it works!

Edit: forgot to mention that looping the script works to
thanks 1 user thanked TL68 for this useful post.
doggy on 2/20/2026(UTC)
Users browsing this topic
Guest
27 Pages«<252627
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.