logo

Live Production Software Forums


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

Notification

Icon
Error

2 Pages12>
Options
Go to last post Go to first unread
alexbyrd  
#1 Posted : Thursday, October 8, 2020 12:52:53 AM(UTC)
alexbyrd

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/...ountdownclock.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

thanks 4 users thanked alexbyrd for this useful post.
doggy on 10/8/2020(UTC), TobinT on 11/20/2020(UTC), nikosman88 on 1/21/2022(UTC), KobbyStreamIT on 8/11/2022(UTC)
JessShake  
#2 Posted : Wednesday, October 13, 2021 1:16:41 AM(UTC)
JessShake

Rank: Member

Groups: Registered
Joined: 2/9/2021(UTC)
Posts: 16
United States
Location: Oklahoma

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
That is fantastic! Could you point me in the direction of modifying this to work with a countdown timer instead of a countdown clock?
Aecast  
#3 Posted : Tuesday, October 19, 2021 12:26:58 PM(UTC)
Aecast

Rank: Advanced Member

Groups: Registered
Joined: 3/25/2020(UTC)
Posts: 48
United Kingdom
Location: Chichester

Was thanked: 10 time(s) in 7 post(s)
Hi JessShake I modified the great work done by Alexbyrd script idea 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
thanks 4 users thanked Aecast for this useful post.
JessShake on 10/20/2021(UTC), APX on 10/23/2021(UTC), akselio on 1/20/2022(UTC), nikosman88 on 1/21/2022(UTC)
JessShake  
#4 Posted : Wednesday, October 20, 2021 1:00:40 AM(UTC)
JessShake

Rank: Member

Groups: Registered
Joined: 2/9/2021(UTC)
Posts: 16
United States
Location: Oklahoma

Thanks: 2 times
Was thanked: 1 time(s) in 1 post(s)
Thank you Aecast! This looks amazing. Exactly what I need!

-Jess
APX  
#5 Posted : Saturday, October 23, 2021 6:53:46 PM(UTC)
APX

Rank: Newbie

Groups: Registered
Joined: 1/5/2021(UTC)
Posts: 4
France, Metropolitan
Location: Paris

Thanks: 2 times
Hello Guys,
thank you for this very usefull script!

May i ask few questions, i'm a script beginer ?

Aecast, your script only works for countdown with HH:mm:ss display format. Would it be possible to adapt the script for a MM:SS countdown?

Another question, is there an option in Vmix to continue the countdown after expiration? I didnt find it.

Thank you for your help!

Regards.

Aurélien
APX  
#6 Posted : Saturday, October 23, 2021 7:38:52 PM(UTC)
APX

Rank: Newbie

Groups: Registered
Joined: 1/5/2021(UTC)
Posts: 4
France, Metropolitan
Location: Paris

Thanks: 2 times
Of course, i can crop my countdown, but i wonder if there is a proper way to do that ;)
doggy  
#7 Posted : Saturday, October 23, 2021 8:48:05 PM(UTC)
doggy

Rank: Advanced Member

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

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

Aecast, your script only works for countdown with HH:mm:ss display format. Would it be possible to adapt the script for a MM:SS countdown?


If the countdown display is set to mm:ss then just remove the '& HHMMSS(2)' from the 'timevar = HHMMSS(0) & HHMMSS(1) & HHMMSS(2)' line

thanks 1 user thanked doggy for this useful post.
APX on 10/23/2021(UTC)
doggy  
#8 Posted : Saturday, October 23, 2021 8:59:45 PM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 291 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: APX Go to Quoted Post
Another question, is there an option in Vmix to continue the countdown after expiration? I didnt find it.


It's a countdown and stops when reaching the set time ;-)

setup a second countdown (set to reverse) and trigger it to start with the OnCountdownCompleted of the first
APX  
#9 Posted : Saturday, October 23, 2021 11:47:41 PM(UTC)
APX

Rank: Newbie

Groups: Registered
Joined: 1/5/2021(UTC)
Posts: 4
France, Metropolitan
Location: Paris

Thanks: 2 times
Yes, Thank you, that is what i did.

I'll Try to learn how to do everything with one script!
APX  
#10 Posted : Saturday, October 23, 2021 11:53:22 PM(UTC)
APX

Rank: Newbie

Groups: Registered
Joined: 1/5/2021(UTC)
Posts: 4
France, Metropolitan
Location: Paris

Thanks: 2 times
Originally Posted by: doggy Go to Quoted Post
Originally Posted by: APX Go to Quoted Post

Aecast, your script only works for countdown with HH:mm:ss display format. Would it be possible to adapt the script for a MM:SS countdown?


If the countdown display is set to mm:ss then just remove the '& HHMMSS(2)' from the 'timevar = HHMMSS(0) & HHMMSS(1) & HHMMSS(2)' line



Thank you that is exactly what i was trying to do_
psysjde1  
#11 Posted : Wednesday, December 8, 2021 5:00:24 AM(UTC)
psysjde1

Rank: Newbie

Groups: Registered
Joined: 2/19/2020(UTC)
Posts: 1
United Kingdom
Location: Lonon

Will or is there a way to get this to work for a count up timer??

Thanks. Jon
xiangyabing  
#12 Posted : Saturday, December 11, 2021 6:11:29 PM(UTC)
xiangyabing

Rank: Newbie

Groups: Registered
Joined: 12/11/2021(UTC)
Posts: 1

Thanks: 1 times
学习了,谢谢分享
doggy  
#13 Posted : Saturday, December 11, 2021 6:15:48 PM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 291 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: xiangyabing Go to Quoted Post
学习了,谢谢分享


Oh yeah that's the answer LOL

doggy  
#14 Posted : Saturday, December 11, 2021 6:19:27 PM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 291 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: psysjde1 Go to Quoted Post
Will or is there a way to get this to work for a count up timer??

Thanks. Jon


Sure, use reverse logic
akselio  
#15 Posted : Thursday, January 20, 2022 1:20:57 AM(UTC)
akselio

Rank: Newbie

Groups: Registered
Joined: 1/20/2022(UTC)
Posts: 3
Finland
Location: Helsinki

Thanks: 1 times
Hi,

And thanks for the script it is awesome!

But.. Is there an easy way to use input name instead of input number?
doggy  
#16 Posted : Thursday, January 20, 2022 1:29:47 AM(UTC)
doggy

Rank: Advanced Member

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

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

And thanks for the script it is awesome!

But.. Is there an easy way to use input name instead of input number?


Sure use the input name instead of the number (string instead of an integer)
akselio  
#17 Posted : Friday, January 21, 2022 1:32:25 AM(UTC)
akselio

Rank: Newbie

Groups: Registered
Joined: 1/20/2022(UTC)
Posts: 3
Finland
Location: Helsinki

Thanks: 1 times
When i change input number to input name i get error on LINE 41: Object reference not set to an instance of an object.

ORIGINAL code in LINE 8 :
Dim InputNo as Integer = 24


I Change it to LINE 8 :
Dim InputNo as String = "COUNTDOWN"


And i get error on this LINE 41 dim xmlct As string = x.SelectSingleNode("//input[" & InputNo & "]/text[1]/text()").value


What i am doing wrong..again
doggy  
#18 Posted : Friday, January 21, 2022 3:00:42 AM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 291 times
Was thanked: 955 time(s) in 790 post(s)
Originally Posted by: akselio Go to Quoted Post
When i change input number to input name i get error on LINE 41: Object reference not set to an instance of an object.

ORIGINAL code in LINE 8 :
Dim InputNo as Integer = 24


I Change it to LINE 8 :
Dim InputNo as String = "COUNTDOWN"


And i get error on this LINE 41 dim xmlct As string = x.SelectSingleNode("//input[" & InputNo & "]/text[1]/text()").value


What i am doing wrong..again



Bad node selection code
Honestly don't know why not have used the - Input.Find( - function instead of working on the xml. It's available and way clearer to understand if one is not familiar with scripting and especialy XML Xpaths


Code:
dim xmlct As string = x.SelectSingleNode("//input[@title='" & InputNo & "']/text[1]/text()").value

'and

dim xmlct As string = Input.Find(InputNo).Text("Time.Text")  'see helpfiles

'gets you the same result (Be sure the have the input name correct and in full )

'Your choise :-)
akselio  
#19 Posted : Saturday, January 22, 2022 3:27:05 AM(UTC)
akselio

Rank: Newbie

Groups: Registered
Joined: 1/20/2022(UTC)
Posts: 3
Finland
Location: Helsinki

Thanks: 1 times
Thanks! Now it´s working like charm!
DoyleTX  
#20 Posted : Thursday, May 26, 2022 3:26:15 AM(UTC)
DoyleTX

Rank: Member

Groups: Registered
Joined: 5/21/2015(UTC)
Posts: 16
Location: Houston

Was thanked: 1 time(s) in 1 post(s)
Hi, this is great and thanks everyone for sharing. I was just curious to know if there was an easy string that could replace the flashing ending time and actually cause the timer to start counting up (reverse) after it reaches 0:00 in red color. This would indicate how long the speaker has gone over their time and would be super useful. Usually, I send a single counter input (with this script) to the monitor, so creating a second timer with a trigger on another input isn't possible for my use case.
Users browsing this topic
Guest (4)
2 Pages12>
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.