Announcement

Collapse
No announcement yet.

Time / Date in script

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Time / Date in script

    Greetings!
    I do not know programming but have taken parts of someone's script for the LED sign and can make it work. How can I make the BetaBrite display the time & date on a single line?

    See here which is the time part of the script. Any suggestions?



    Code:
    	ElseIf message = "Time" Then
    		Dim currentTime as Date = TimeOfDay
    		message = "{transition=auto}{flash=no}{color=dimgreen}" & CStr(Format(currentTime, "Short Time")) & "{transition=rollleft}"
    Thanks!

    #2
    Originally posted by Monk View Post
    Greetings!
    I do not know programming but have taken parts of someone's script for the LED sign and can make it work. How can I make the BetaBrite display the time & date on a single line?

    See here which is the time part of the script. Any suggestions?



    Code:
    	ElseIf message = "Time" Then
    		Dim currentTime as Date = TimeOfDay
    		message = "{transition=auto}{flash=no}{color=dimgreen}" & CStr(Format(currentTime, "Short Time")) & "{transition=rollleft}"
    Thanks!
    Even better might be how to have the BetaBrite sign display the time and date on its own. Without me needing to send the data via script.

    For anyone interested, here is the entire script - not necessarily clean looking but it does work.

    Code:
    Sub Main(ByVal Parms As object)
    	'Examples:
    	'This is test 1
    	'{transition=fireworks}{font=five}{color=red}{flash=yes}Hello{font=seven}
    '{color=orange} World{flash=no}{transition=sparkle}
    	'{font=fivebold}{color=orange}Hello{font=seven}{color=green} There
    	'{font=five}{color=green}Temp is 24 degrees{transition=rotate}
    	'{flash=yes}BetaBrite{flash=no}
    	'I {extchar=heart} BetaBrite
    
    	Dim ParmArray() as String
    	ParmArray = Parms.tostring.split(",")
    	Dim sign = CInt(ParmArray(0))
    	Dim loc = ParmArray(1)
    	Dim message = ParmArray(2)
    	Dim logName = "BetaBrite"
    	Dim debug = False
    
    	If message = "Temperature" Then
    		message = "{transition=hold}{flash=no}{color=dimgreen}" & CStr(hs.DeviceValueEx(291)) & "° M Bath" & "{transition=auto}"
    
    Elseif message = "OutTemp" Then
    		message = "{transition=hold}{flash=no}{color=dimgreen}" & CStr(hs.DeviceValueEx(1213)) & "° " & CStr(hs.DeviceValueEx(1254)) & "° " & CStr(hs.DeviceValueEx(1252)) & "%" & "{transition=rollleft}"
    
    Elseif message = "Humidor" Then
    		message = "{transition=hold}{flash=no}{color=dimred}" & CStr(hs.DeviceValueEx(1264)) & "% Cigars " & CStr(hs.DeviceValueEx(1263))& "°" &"{transition=rollright}"
    
    Elseif message = "ArmStat" Then
    		message = "{transition=hold}{flash=no}{color=dimgreen}"& 
    ""  & CStr(hs.DeviceString(242))& "{transition=rollleft}"
    
    Elseif message = "Power" Then
    		message = "{transition=hold}{flash=no}{color=dimred}" & CStr(hs.DeviceValueEx(956)) & "a " & CStr(hs.DeviceValueEx(954)) & "w " & "{transition=rollleft}"
    
    	ElseIf message = "Time" Then
    		Dim currentTime as Date = TimeOfDay
    		message = "{transition=auto}{flash=no}{color=dimgreen}" & CStr(Format(currentTime, "Short Time")) & "{transition=rollleft}"
    
    	ElseIf message = "Caller" Then
    		dim calleridname, calleridnumber As String
    		'calleridname = hsp.CIDName(1)
    		'calleridnumber = hsp.CIDNumber(1)
    		If calleridname = "" Then calleridname = "Unknown Caller"
    		If calleridnumber = "" Then calleridnumber = ""
    		message = "{transition=hold}{flash=no}{color=red}" & " Call From " & calleridname & "(" & calleridnumber & ")" & "{transition=hold}"
    	End If
    
    	If debug Then hs.writelog(logname, CStr(sign) & " - " & loc & " - " & message)
    	hs.PluginFunction("BLLED", "", "SetMessage", New Object(){sign, loc, message})
    
    End Sub
    It would seem this should be easy but I'm tapped out.

    Comment


      #3
      So I googled for a while & fiddled for an hour and made it work. Here is what I ended up with to make time and date appear on the one line.
      Code:
      	ElseIf message = "Time" Then
      		Dim currentTime as Date = TimeOfDay
      		message = "{transition=auto}{flash=no}{color=dimgreen}" & CStr(Format(currentTime, "Short Time")) & " " & today & "{transition=rollleft}"

      Comment

      Working...
      X