vMix Forums
»
General
»
3rd Party Software and Development
»
simple scripting - countdown colour change clock for events
Rank: Member
Groups: Registered
Joined: 5/3/2015(UTC) Posts: 10 Location: UK
Was thanked: 6 time(s) in 3 post(s)
|
Here is a very simple script that will work with a countdown timer made in GT designer - dropbox link attached.
as it gets closer to the end of the countdown it goes from green (plus 5 mins) to yellow (5 - 2 mins) to red (0 - 2 mins) and flashes red/white once it runs out of time.
It uses the countdownclock.gtzip which is just a simple countdown timer.
Its been working on multiple events and keeping speakers to time as best as possible, as we send it back on a reverse feed on all the vimxcallers.
As far as I can tell It does not handle time that crosses midnight - as most of the events I do are across the day its not been an issue.
Hope someone finds it useful or as a bit of a jump start into scripting in vmix, as there is not much to go on sometimes.
Enjoy.
https://www.dropbox.com/s/ktsanzngb5cotsi/countdownclock.gtzip?dl=0
here's is the script for vmix scripting.
dim i As Integer dim time1 as String dim hourset as String dim minset as String dim secset as String dim Timemake as string dim date1 as DateTime dim remainingtime as TimeSpan dim rightnow as dateTime dim flashx as Boolean dim tClose as Integer dim tAlmost as Integer
' set parameters flashx = false i = 1 tClose = (5*60) ' set to 5 mins - is number of seconds tAlmost = (2*60) ' set to 2 mins - - is number of seconds
Do Until i = 2
' if you don't have countdownclock.gtzip and a field called Countdown.Text it won't do much dim content as string = Input.Find("countdownclock.gtzip").Text("CountDown.Text") 'Console.WriteLine(content) 'Console.WriteLine(content.Substring(3,2)) 'Console.WriteLine(content.Substring(6,2)) 'Console.WriteLine(content.Substring(9,2)) 'Console.WriteLine(System.DateTime.Now.ToLongTimeString + " " + content) rightnow = DateTime.Now hourset = content.Substring(3,2) minset = content.Substring(6,2) secset = content.Substring(9,2)
Timemake = hourset & ":" & minset &":" & secset 'Console.WriteLine(Timemake) Try date1 = Convert.ToDateTime(Timemake) Catch ex As System.Exception ' nothing End Try remainingtime = date1.Subtract(rightnow) console.Writeline("Time Left -" +remainingtime.TotalSeconds.Tostring)
If remainingtime.TotalSeconds > tClose then API.Function("SetTextColour",Input:="countdownclock.gtzip",Value:="40,200,40") Else if remainingtime.TotalSeconds < tAlmost then API.Function("SetTextColour",Input:="countdownclock.gtzip",Value:="255,40,40") Else API.Function("SetTextColour",Input:="countdownclock.gtzip",Value:="Yellow") End if
' Flash when out of time. if remainingtime.TotalSeconds < 1 then if flashx = true then API.Function("SetTextColour",Input:="countdownclock.gtzip",Value:="255,255,255") flashx = false Else API.Function("SetTextColour",Input:="countdownclock.gtzip",Value:="255,40,40") flashx = true End if End if
Sleep (300)
Loop
|
 1 user thanked alexbyrd for this useful post.
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 5/24/2014(UTC) Posts: 44   Location: Brazil Thanks: 53 times Was thanked: 5 time(s) in 3 post(s)
|
Hi Alexbyrd, the dropbox link isnt functional. Thanks
|
|
|
|
Rank: Member
Groups: Registered
Joined: 5/3/2015(UTC) Posts: 10 Location: UK
Was thanked: 6 time(s) in 3 post(s)
|
link fixed - thanks for letting me know.
|
|
|
|
Rank: Advanced Member
Groups: Registered
Joined: 3/25/2020(UTC) Posts: 48  Location: Chichester Was thanked: 10 time(s) in 7 post(s)
|
Hi I thought the script idea maybe good for those who want to use on the VMIX GT Timers, so have rewritten to work on the input you set the VMIX GT Timer on and use the API to compare the countdown time checks.
Also as defined below have set variables so you can change several settings
Variables InputNo = The Input the GT Timer is on countdowncolor = The default colour of the countdown
wrapuptime = Presenters first warning for color change i.e 5 minutes = 500 wrapuptimecolor = Colour change for Presenters first warning i.e YELLOW
finalcall = Presenters Second warning for color change i.e 2 minutes = 200 finalcallcolor = Colour change for Presenters second warning i.e RED
flashcolor = When reach 00:00:00 the colour to flash with finalcallcolor
Countdown time checks are calculated by taking the time string and converting to Integer to compare i.e string "00:05:00" = 5 minutes left = 500. so for example the wrapuptime variable is 500 The countdown value will always be lower than the check values in this format.
'************************************************************************************ '** Color Changing Countdown timer for standard VMIX GT timer - TimerCentre.gtzip ** '** '** Set variables for your required colour change times '**
'** InputNo = The input the time is setup on i.e input = 4 Dim InputNo as Integer = 24 '** Set the Countdown timer color when started. dim countdowncolor AS String = "Orange"
'** wrapuptime = The first time color change to warn time nearly up '** Countdown Time HH:MM:SS is converted to an integer. 01:10:00 = 11000 '** so 5 minute wrapup is 00:05:00 = 500. dim wrapuptime as Integer = 500 dim wrapuptimecolor AS String = "Yellow"
'** finalcall = The second time colour change to warn end of presenting '** Countdown Time HH:MM:SS is converted to an integer. 01:10:00 = 11000 '** so 2 minute finalcall is 00:02:00 = 200. dim finalcall as Integer = 200 dim finalcallcolor AS String = "Red"
'** Set the flash colour with the finalcallcolor when countdown 00:00:00 dim flashcolor AS String = "Black"
'** set parameters dim flashtimer as Boolean dim x as new system.xml.xmldocument Dim HHMMSS As String() dim i as integer dim timevar AS String flashtimer = false i = 1
Do Until i = 2
x.loadxml(API.XML()) 'Fetch the current countdown time ************************************ dim xmlct As string = x.SelectSingleNode("//input[" & InputNo & "]/text[1]/text()").value
'** Create a time string HHMMSS *************************************** HHMMSS = xmlct.Split(New Char() {":"c}) timevar = HHMMSS(0) & HHMMSS(1) & HHMMSS(2)
' Convert Time String HHMMSS into a integer i.e 00:05:00 = 500 ******* dim timevarint as integer = Convert.toInt32(timevar)
'** Check if countdowntimer reached wraptuptime and finalcall ********** If timevarint > wrapuptime then API.Function("SetTextColour",Input:=InputNo,Value:=countdowncolor) Else if timevarint < finalcall then API.Function("SetTextColour",Input:=InputNo,Value:=finalcallcolor) Else API.Function("SetTextColour",Input:=InputNo,Value:=wrapuptimecolor) End if
' Flash timer when out of time timevarint is 00:00:00 = 0 if timevarint < 1 then if flashtimer = true then API.Function("SetTextColour",Input:=InputNo,Value:=flashcolor) flashtimer = false Else API.Function("SetTextColour",Input:=InputNo,Value:=finalcallcolor) flashtimer = true End if End if
Sleep (1000) Loop
|
 1 user thanked Aecast for this useful post.
|
|
|
vMix Forums
»
General
»
3rd Party Software and Development
»
simple scripting - countdown colour change clock for events
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