(Indigo) Scripting to automatically send a command on a regular interval

Indigo supports a scripting feature where you can automate commands sent to the connected terminal session and/or monitor and manipulate received data.  

In this example, we will provide an example script that sends the "date" command to the connected terminal session every 10 seconds.

 

Please see the following help topic for information on how to setup Indigo to use a post-processing script file.
>> Scripting

 

The Indigo Session Properties must be configured to enable the Post Processing Script feature and configured for the correct script file and function.

indigo-auto-sender-script.png

 

 

This  AutoSender.vbs script file is attached to this post/article.  Please see the bottom of the page to download this script file.

 

This script works by queuing a command to be transmitted in 10 seconds when a connection is first established.  The script then watches for the command to be transmitted and when the command is detected, the script queues the next command with another 10 second delay.  

'///////////////////////////////////////////////////////////
'///////////////////////////////////////////////////////////
'//
'// Indigo Terminal Emulator
'// Timed Command Automation Script
'// Version 1.0
'//
'// shadeBlue Software
'// http://www.shadeblue.com
'//
'///////////////////////////////////////////////////////////
'///////////////////////////////////////////////////////////

'// declare program constants
Const MY_COMMAND = "date"

 

'//------------------------------------
'// Host connection established
'//------------------------------------
Sub Host_Connected()

'// say hello
Host.Post vbCrLf
Host.Post "--------------------------------------------------------------------" & vbCrLf
Host.Post "SCRIPT STARTED" & vbCrLf
Host.Post "--------------------------------------------------------------------" & vbCrLf

'// enqueue first command
EnqueueCommand

End Sub


'//------------------------------------
'// Host connection disconnected
'//------------------------------------
Sub Host_Disconnected()

'// clear host command queue
Host.Queue.Clear

'// say goodbye
Host.Post vbCrLf
Host.Post "--------------------------------------------------------------------" & vbCrLf
Host.Post "SCRIPT SUSPENDED" & vbCrLf
Host.Post "--------------------------------------------------------------------" & vbCrLf

End Sub


'//------------------------------------
'// Host attempting to send data command
'// (Return the command to process)
'//------------------------------------
Function Host_Send(Byval command)

'// if we see out command issued, then we can enqueue the next cycle
if (command = MY_COMMAND) then

Host.Post "--------------------------------------------------------------------" & vbCrLf
Host.Post "SCRIPT QUEUEING NEXT COMMAND" & vbCrLf
Host.Post "--------------------------------------------------------------------" & vbCrLf

EnqueueCommand

end if

'// transmit unmodified command
Host_Send = command

End Function


'//-----------------------------------------------------------
'// This function queues the next command
'//-----------------------------------------------------------
Function EnqueueCommand()

'// clear host command queue
Host.Queue.Clear

'// wait 10 seconds before sending command
Host.Queue.Add MY_COMMAND, 10000

'// begin processing the queued instructions
Host.Queue.Send

End Function

 

'//-----------------------------------------------------------
'// This function is needed to configure the Indigo session
'// scripting options. This is effectivaly a NO-OP function
'//-----------------------------------------------------------
Function ReceiveData(ByVal sData)

'// don't do anythere here
'// just return the data received
ReceiveData = sData

End Function

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk