No announcement yet.

Time trigger in Trio

  • Filter
  • Time
  • Show
Clear All
new posts

  • Time trigger in Trio

    Hello All,

    I have an excel sheet that is feeding a scene in Trio. I need the script to look at the system clock and trigger a part of the script according to what time it is. So if it is between 5 am and 9 am it runs a function according to that time range. If it is between 9 am and 1 pm it runs another function. Any Ideas?


  • #2
    We sort of had this functionality built for the Winter Olympics. We had the Olympic rings in the graphics till the 5th of march then the script would check what date it was and change the Olympic rings to the Paralympic logo instead. No need to change all the graphics for the Para games it was all done automaticly.
    It was setup sort of like how you would use an omo with the 2 logos and the script decided which one to show.

    Hope this can point you in the right direction. This was dates but im sure you can work out the time in this.

    sub OnInitParameters()
        RegisterPushButton("btnExecute", "Test", 1)
        RegisterParameterString("Date","Comparison Date:","21/02/2018",20,20,"")
    end sub
    sub OnExecAction(byval iButtonId as Integer)
        if iButtonId == 1 then
        end if
    end sub
    Sub TestDate()
        if CompareDate(GetParameterString("Date")) Then
            this.FindSubContainer("ParaOL").active = true
            this.FindSubContainer("OL").active = false
            println("Do it Now!")
            this.FindSubContainer("ParaOL").active = false
            this.FindSubContainer("OL").active = true
            println("Not Yet!")   
        End If
    End Sub
    ' INPUT FORMAT : 21/2/2018  (DayOfMonth/Month/Year)
    Function CompareDate(inputDate as String) as Boolean
        Dim CurrentDateAfterRequested as Boolean = false        
        ' Process input to array
        Dim aInputDate as Array[string]    
        inputDate.Split("/", aInputDate)    
        ' Define DateTime to get total number of seconds
        Dim inputAsDateTime as DateTime
        inputAsDateTime.DayOfMonth = cInt(aInputDate[0])
        inputAsDateTime.Month = cInt(aInputDate[1])
        inputAsDateTime.Year = cInt(aInputDate[2])    
        Dim requestDate as Integer = inputAsDateTime.TotalSeconds    
        ' Get current time
        Dim todaysDate as DateTime = GetCurrentTime()
        Dim currentDate as Integer = todaysDate.TotalSeconds    
        ' Perform compare
        if currentDate > requestDate Then
            CurrentDateAfterRequested = true        
        End If
        CompareDate = CurrentDateAfterRequested
    End Function
    Last edited by Lars Henriksen; 03-21-2018, 08:13 AM.


    • #3
      Thanks Lars


      • #4
        This is what i got to work. Don't know if its the best scripting but it works according to the time. Tab field 31 is getting the system time. It then compares the system time to the "if then" condition in the function (it will be either "TRUE" or "FALSE". If true then it runs the appropriate function.

        '--------------------------TIME OF DAY OPTION-------------------
        Sub OnRead
        TrioCmd("page:set_property 31 " & Time)
        end sub

        '----------------------TIME CHANGER----------------------
        function TimeChange

        if TrioCmd("page:get_property 31") > "05:00:00 AM" and TrioCmd("page:get_property 31") < "09:00:00 AM" then


        elseif TrioCmd("page:get_property 31") > "09:00:00 AM" and TrioCmd("page:get_property 31") < "1:00:00 PM" then


        end if

        end function