The simple example profile below connects to two devices - a relay controller named "RelayBoard" and a temperature sensor named "TempSensor". These devices are both serial and connected to the PC on separate com ports with different settings (see serial devices for more on configuring com ports). The profile operations begin in the main script when it sets the device for all subsequent communications to RelayBoard and sends out "R1on{13}" (the {13} represents a character return via the ASCII character code) on the next command. This theoretical relay board will turn on relay 1 when it receives "R1on" followed by a carriage return. Then ComScript sets the device to the TempSensor and sends out "Sample{13}". The theoretical temperature sensor responds to the command by outputting "temperature=" followed by a temperature value and a carriage return when it receives "Sample" followed by a carriage return. Parsing the strings returned from devices is covered in detail in the Data Parsing 'section, but in this hypothetical example, the temperature value characters that follow the trigger (temperature=) and up to and including the terminator (carriage return{13}) are written to CollectionFile.txt in the local\data directory.
<profile interval="900">
<device name="RelayBoard" type="serial" port="COM1" baudrate="38400" parity="None" stopbits="1" databits="8" dtr="False" handshake="None" />
<device name="TempSensor" type="serial" port="COM2" baudrate="9600" />
<script name="main"> <!-- this is where the profile begins execution -->
<setdevice name="RelayBoard" />
<send string="R1on{13}" />
<pause seconds="30" />
<setdevice name="TempSensor" />
<send string="Sample{13}" file="CollectionFile.txt" trigger="temperature=" terminator="{13}" timeout="8000" type="Text" keeptrigger="false" keepterminator="true" />
<setdevice name="RelayBoard" />
<send string="R1off{13}" />
</script>
</profile>