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
njfeathe85  
#1 Posted : Wednesday, March 10, 2021 2:42:59 AM(UTC)
njfeathe85

Rank: Member

Groups: Registered
Joined: 9/17/2020(UTC)
Posts: 18
United Kingdom
Location: Leeds

Thanks: 2 times
Was thanked: 3 time(s) in 3 post(s)
So i've spent AAAAAGGGGGEEEEESSSSS looking and trying to work out how to display the current time in a specific time zone as a title and include the time zone initials AND have it loop as a continuous time. I had worked it out a few weeks ago but then a subsequent vmix re-install and I lost it so i'm putting in here for anyone else wanting it and my own benefit if i lose it again.

All is compared against UTC.

Create vmix time input and then enter this into the scripting module

EDIT: - Have tidied these up a little to be a bit more user friendly and more efficient for the computer.

Code:


'Time of Day for GMT time zone - BUT ADAPT AS NECESSARY

'Set your Time Zone Offset to universal time coordinated eg. New York -5hrs or Sydney +11
Dim tzo as integer
tzo = 0

'Set your Time Zone Initials - eg. EST - Eastern Standard time
Dim tzi as string
tzi = "  GMT"

'Set the vmix input name to write the timer to
Dim ipname as string
ipname = "daytime"

Dim newtime as string

Dim currenttime as string
currenttime = newtime + tzi

Do while true

newtime = datetime.utcnow.addhours(tzo).tostring("HH:mm:ss")
currenttime = newtime + tzi

API.Function("Settext", input:=ipname, selectedindex:="0", value:=currenttime) 

Sleep(300)
Loop




Code:


'Time of Day for CET time zone - BUT ADAPT AS NECESSARY

'Set your Time Zone Offset to universal time coordinated eg. New York -5hrs or Sydney +11
Dim tzo as integer
tzo = +1

'Set your Time Zone Initials - eg. EST - Eastern Standard time
Dim tzi as string
tzi = "  CET"

'Set the vmix input name to write the timer to
Dim ipname as string
ipname = "daytime"

Dim newtime as string

Dim currenttime as string
currenttime = newtime + tzi

Do while true

newtime = datetime.utcnow.addhours(tzo).tostring("HH:mm:ss")
currenttime = newtime + tzi

API.Function("Settext", input:=ipname, selectedindex:="0", value:=currenttime) 

Sleep(300)
Loop






Another neat trick is to create a browser input and put the following into the address field so that the script auto starts when you open your preset -

"http://localhost:8088/API/?Function=scriptstart&value=nameofscript"
doggy  
#2 Posted : Wednesday, March 10, 2021 3:17:06 AM(UTC)
doggy

Rank: Advanced Member

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

Thanks: 293 times
Was thanked: 955 time(s) in 790 post(s)
Would be nice if the code was put in (language) quotes !

Code:
Dim d1 As DateTime = DateTime.Now.AddHours(3)
API.Function("SetText",Input:=45,SelectedIndex:="0" ,Value:=d1.ToString("dd/MM/yy H:mm:ss"))


Glad you figured it out though :-)
thanks 1 user thanked doggy for this useful post.
studiodelta on 11/13/2021(UTC)
njfeathe85  
#3 Posted : Wednesday, March 10, 2021 3:59:52 AM(UTC)
njfeathe85

Rank: Member

Groups: Registered
Joined: 9/17/2020(UTC)
Posts: 18
United Kingdom
Location: Leeds

Thanks: 2 times
Was thanked: 3 time(s) in 3 post(s)
Originally Posted by: doggy Go to Quoted Post
Would be nice if the code was put in (language) quotes !

Code:
Dim d1 As DateTime = DateTime.Now.AddHours(3)
API.Function("SetText",Input:=45,SelectedIndex:="0" ,Value:=d1.ToString("dd/MM/yy H:mm:ss"))


Glad you figured it out though :-)


Learned a new thing! Didn’t know how to do language quotes. Done. 👍
thanks 1 user thanked njfeathe85 for this useful post.
doggy on 3/10/2021(UTC)
Users browsing this topic
Guest (2)
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.