Version 3 released!

Version 3 released! See the announcement

Arrivals and Departures now has Swiss real-time data too!

Recording Scripts

RemoteSign devices can record a set of RemoteSign commands and then play them back later without any external controller. This provides the ability to define a complex script and have it run locally automatically.

The capability is available as follows:

Support for recording scripts is also built into RemoteSign Sequencer 3.0 and higher.

Recording related commands

Here are the new commands that have been added to handle recording:

  • {RECORD}
    Starts and stops recording
  • {APPEND}
    Add a command (with a delay) to the script being recorded
  • {RUNSCRIPT}
    Run a script on the RemoteSign
  • {DIR}
    Requests a list of scripts and optionally their content too as {MSG} commands
  • {SCR?}
    Requests a list of scripts in a {SCR} command
  • {SCR}
    Provides a list of script files present.
  • {NTP}
    Tells a RemoteSign ESP to fetch the current time from the internet.

The above commands are described in more detail in the SDK

Recording a script

Recording is initiated by sending a {RECORD} command with a name of the script to be recorded. All commands sent to that RemoteSign will then be recorded into that script file until recording is stopped. Note: Script files are case insensitive on Windows but case sensitive on ESP. (This is due to the nature of the respective file systems).

On RemoteSign Windows, from the main sign screen, pressing Shift-R will prompt for a script filename and begin recording to that file. 

During recording, the {APPEND} command can be used to add commands to the recording without them also executing on the RemoteSign. The time delay for the command is passed to the RemoteSign within the {APPEND} command, so it does not have to wait for the delay to measure how long the delay has to be. This allows the rapid recording of a script.

Recording is stopped in the following ways

  • by sending a {RECORD} without a file name.
  • by sending another {RECORD} command with a file name, which ends the current recording session and starts a new one with the new file.
  • On RemoteSign Windows, from the main sign screen, pressing "r"

Deleting a script

If recording is ended without any commands being sent, the (now empty) script file will be deleted. For example, these two commands will delete a script file called "SomeScript":

{RECORD}SomeScript 
{RECORD}

Running a script

A recorded script can be started in the following ways:

  • By sending a {RUNSCRIPT} command with the name of the script to be started
  • When the RemoteSign starts up it will automatically run a script called AUTORUN
  • Via the actuation of a sensor on the RemoteSign. For example, a script named Sensor2On will be run if sensor 2 goes on.
  • On RemoteSign for Windows, scripts can be started from the Start Script menu that pops up from right mouse click from the main sign screen.
Notes
  1. On RemoteSign Windows, if an AUTORUN script file is present, the last saved RemoteSign file will not be loaded. If you want load a file, include a {LOAD} command in the script.
  2. A RemoteSign ESP must connect to a wifi network before running any script. This is because it needs access to the internet in order to fetch the current time, update firmware and have scripts recorded, etc.

Stopping a script

A running script can be terminated in the following ways:

  • The script coming to an end by itself
  • Sending a {RUNSCRIPT} command with no script name
  • Sending a {RUNSCRIPT} command with a script name. The script can be the same name or a different one, which will then start it its beginning.
  • On RemoteSign for Windows, scripts can be stopped from the Stop Script menu that pops up from right mouse click from the main sign screen.

Editing a script

The files on a RemoteSign ESP are not easily accessible to edit. The script files on Windows can be found in the scripts within the RemoteSign installation folder. They have the extension .RSscript
Yes, you can edit them (at your own peril) so long as you use an editor that preserves the special characters used to separate commands and parameters, such as NotePad++. Set all characters to be viewable so you can avoid disturbing them. Each line is a delay in milliseconds then an STX character and then a RemoteSign command as described in the SDK.

RemoteSign Sequencer

It is important to differentiate scripts that run in RemoteSign Sequencer from scripts that run locally on RemoteSigns. Sequencer scripts can branch and react to various triggers, send commands to RemoteSigns, and they can make a RemoteSign record a copy of those commands as a local script on the RemoteSign computer.

Dedicated buttons are provided to send {RECORD}, {RUNSCRIPT}, and {SCR?} commands.

The round 'record button' will initiate recording with whatever script file name is in the script list on all connected RemoteSigns. Recording mode is indicated by a red color.

The square 'stop recording' button will send an empty {RECORD} command to all connected RemoteSigns to end recording.

The triangular 'play' button will send a {RUNSCRIPT} command with the name of the currently defined script to the current RemoteSign

The 'stop script' button will send an empty {RUNSCRIPT} command to the current RemoteSign

To aid the recording of scripts, there are some settings related to recording:

"Skip {RECORD}"

This setting is on by default whenever a Sequencer file is opened. It prevents {RECORD} commands in scripts being sent out to any RemoteSigns. This ensures that scripts that are run do not start inadvertently re-recording scripts when they are run. If you wish to have a script initiate recording, switch this option off. This setting can be set using the Setting system command. One can therefore define a script that turns this safety net off and then start recording.

"Sync -> NTP"

This setting will substitute an {NTP} command for the system command "Sync clocks" if recording is in progress. Sync clocks will otherwise send the current local time to a RemoteSign, but that makes little sense if recording. The {NTP} command will instruct a RemoteSign ESP device to fetch Internet time since it has no real-time clock of its own. RemoteSign Windows use the current time automatically so it ignores the {NTP} command.

This setting can be set in a script using the Setting system command.

"Fast Recording"

This setting causes Sequencer to ignore all delays in scripts. In this mode, when recording, all commands are sent using the {APPEND} command with the appropriate delay that should be observed. This allows scripts that have delays in them to be recorded without having to wait for the scripts to play out in real-time. When the scripts are run the RemoteSign they will honor the delays. 

This setting can be set using the Setting system command. One can therefore define a script that turns fast recording on, and then start recording.


Best practices when writing scripts to be recorded on RemoteSigns

If you only need to record a static display, you can simply press the record button in RemoteSign Sequencer, run the scripts that produces the display and then press the stop button. If, on the other hand, you have a sequence of scripts that change the display and even get into a loop, then it is best to proceed as follows:
  1. Create and test the script without recording commands initially. When done, add a new script that sets the recording settings and initiates recording, then triggers the desired starting script 
  2. If your script triggers other scripts, place a {RUNSCRIPT} command before the Trigger command.
  3. At the start of the script that is triggered, place a {RECORD} command with a script name that matches the name used on the {RUNSCRIPT} command.

Here is an example set of a scripts that set up the screen and then starts a loop

Script: setup screen

 0 sample: Send current time to RemoteSign 
 0 sample:{CLOCK} Digital 24 hour
 0 sample:{CLEAR}
 0 sample:{ROWS} 8
 0 sample:{SCROLL} clear scrolling text
 0 sample:{RUNSCRIPT} TheLoop
 0 Trigger script: Screen1

Script: Screen1

  0 sample:{RECORD} TheLoop
  0 sample:{ROW}Row: 2 This is screen one (Animated)
// wait 13 seconds before starting screen2
13 Trigger script: Screen2

Script: Screen2

 0 sample:{ROW}Row: 2 This is screen two (Animated)
// wait 15 seconds before starting over
15 sample:{RUNSCRIPT} TheLoop
 0 sample:{RECORD} 
// We have now finished recording so we can put the safety back on again:
 0 Setting: Skip {RECORD} commands in scripts: on
 0 Trigger script: Screen1

Script: Record

// Record the script onto the connected RemoteSign
// stop anything already running
 0 sample:{RUNSCRIPT} 
// Ensure that an {NTP} command gets used when setting the time
 0 Setting: Send {NTP} command instead of current tome when recording: on
// set the recording setting to use fast recording, no waiting for delays during recording
 0 Setting: Do not pause when recording, download commands instead: on
// Enable the RECORD command
 0 Setting: Skip {RECORD} commands in scripts: off
// Now start the recording
 0 sample:{RECORD} AUTORUN
 0 Trigger script: setup screen

How it all works

When one runs the script called "Record" it will start recording a script called AUTORUN, and then trigger the script "Setup screen", thus recording all the setup commands. "Setup Screen" triggers script "Screen1", which starts recording a second file called "TheLoop". It places some text on row 1 then triggers "Screen2". "Screen 2" also places some text on row 2. A {RUNSCRIPT} command in that script will tell the recorded script to call TheLoop again when it is running as a script locally. It then ends the recording session with a {RECORD} command.

Since the script called "Record" also sets fast recording on, Sequencer will send all the commands to the connected RemoteSign using {APPEND} commands. The delays defined in scripts "Screen1" and "Screen2" are included in the {APPEND} commands with actually waiting. 

The "Record" script also sets the option to substitute an {NTP} command instead of recording the time the script was recorded. This will allow an ESP based RemoteSign to fetch internet time so that the clock is accurate.

Since the initial file uses the special name "AUTORUN", whenever the RemoteSign with that script file starts up, it will automatically run the script.

Warning

It is possible to record a script that has no delays, and loops onto itself, thus forcing the RemoteSign running the script to go into an endless loop. This should be avoided by ensuring that there are suitable delays within the script.