Sending Current Time & Date

Hi,

I'd like to automate the time setting process on a Linux SBC when loading the software via a telnet window. To do that I'd like to be able to have {Time} and {Date} variables which are substituted for the PC's time and date when the command is sent.

Date {Date}

An expansion of this would be {Year}, {Month}, {Day},{Hour}, {Min}, etc

Date {Hour}:{Min}

Thoughts....

PJE

Have more questions? Submit a request

1 Comments

  • 0
    Avatar
    shadeBlue Software

    Hi Peter,

    Sorry for the delayed response, I was thinking about how to implement this feature using a complex combination of variable replacements, internal commands, and scripting,   But then it dawned on me that we could just use the scripting feature alone to solve this problem and provide you with a completely customizable solution.  

    Below is the help page on the scripting feature:
    http://help.shadeblue.com/display/indigo/Scripting

     

    Attached to this posting is a sample script file inside a ZIP package.  Extract the "DateTimeReplacement.vbs" from the ZIP into the Indigo scripts folder.  

     

    OS VersionDirectory Location
    Windows XP C:\Document and Settings\All Users\Application Data\shadeBlue\Indigo\Scripts
    Windows 2003 Server C:\Document and Settings\All Users\Application Data\shadeBlue\Indigo\Scripts

    Windows Vista

    C:\ProgramData\shadeBlue\Indigo\Scripts
    Windows 7 C:\ProgramData\shadeBlue\Indigo\Scripts
    Windows 8 C:\ProgramData\shadeBlue\Indigo\Scripts
    Windows 2008 Server C:\ProgramData\shadeBlue\Indigo\Scripts

     

    Now in your session properties, select the "Settings" tab and then enable the "Post Processing Script" option.  

     indigo-scripting1.png

    Select the script file named "DateTimeReplacement.vbs" and the script function "DoNothing"

    We are using a "DoNothing" function because we don't want to change any data received by Indigo from the connected host.  In our case we want to modify data that is being sent to the connected host.  The scripting feature supports a callback method named "Host_Send" that lets us inspect and change the command instruction data being transmitted to the connected host.  As you can see from the example below, we simply look for replacement tokens and replace with the output from a VB script call to obtain the appropriate data. 

    '//-----------------------------------------------------------
    '// This event handler will process all command data
    '// destimted to the connected device/host. It will process
    '// the data looking for replacement tokens. If a substitution
    '// token in found, it will replace the token with the
    '// appropriate text.
    '//-----------------------------------------------------------
    Function Host_Send(Byval command)
      Dim result
      result = command
      result = replace(result, "{DATE}", Date)
      result = replace(result, "{YEAR}", Year(Date))
      result = replace(result, "{MONTH}", Month(Date))
      result = replace(result, "{DAY}", Day(Date))
      result = replace(result, "{TIME}", Time)
      result = replace(result, "{HOUR}", Hour(Time))
      result = replace(result, "{MINUTE}", Minute(Time))
      result = replace(result, "{SECOND}", Second(Time))
      Host_Send = result
    End Function

     

    Try this out and see if it meets your needs.  You can add or modify any of the behavior in the script if needed. Just remember to reload your session if you make any changes to the script file.  Indigo will cache the script file in memory while the session is open.  

     

    Thanks, 

    David
    shadeBlue Support




    DateTimeReplacement.zip
Please sign in to leave a comment.
Powered by Zendesk