Script Authoring Guide



These pages contain instructions intended to guide an ESMS administrator through the authoring of scripts for ESMS. The same language is used for both Send-It and Send-It 95.

The scripting language used by ESMS is very simple. Currently it uses single letter commands, but this will be updated to make it easier to author scripts.

Script Commands

 
Command Use
* Defines a script section
P Sets the serial port parameters
C Sets the serial port number
T Sets the timeout period
S Sends a string
W Waits for a string to be received
R Repeats the following two commands if they fail

Example Script

Command Explaination
*CONNECT
This defines the connect section of the script. This section is executed once only, to connect to the GSM/PCN service provider.
C1
Selects COM port 1.
P9600,n,8,1
Defines the communications paramters as 9600 baud, no parity, 8 bits and 1 stop bit.
SATDT0973100602\r
Sends the dial command to the modem.
T60
Sets the time out to 60 seconds.
WCONNECT
Waits for CONNECT to be received.
*SEND
Defines the sending section of the script. This section is executed once for each message that is to be sent.
T10
Set the time out to 10 seconds.
WExit
Wait for Exit to be received.
Ss
Send S via the modem.
W:
Wait for : to be received.
S$NUMBER$\r
Send the mobile number.
W:
Wait for : to be received.
S$MESSAGE$\r
Send the message.
T15
Set the time out to 15 seconds.
Waccepted
Wait for accepted to be received.
*DISCONNECT
Defines the disconnect section of the script. This section is executed once when all messages have been sent.
WExit
Wait for Exit to be received.
Se
Send e via the modem.
S+++
Send +++ to the modem.
WOK
Wait for OK to be received.
SATH\r\n
Send ATH to the modem.
*ERROR
Defines the error section of the script. This section is executed once if there has been an error.
T5
Set the time out to 5 seconds.
S+++
Send +++ to the modem.
WOK
Wait for OK to be received.
SATH\r\n
Send ATH to the modem.
WNO
Wait for NO to be received.
*END
Marks the end of the script.

The above example assumes that the modem doesn't respond to the DTR line being toggled. Most modem hangup when this happens, and ESMS uses this to hangup. This is done automatically, and no commands are required in the *ERROR or *DISCONNECT sections if your modem understands this use of the DTR line. If not, then you will need the commands as given above. The standard scripts provided with ESMS assume the correct use of DTR

You will have noticed a couple of macros (text flanked by $). The available macros are:

Macro Explaination
$MESSAGE$ The message to be sent
$NUMBER$ The destination mobile phone number
$ACK$ ASCII character 0x06
$EOT$ ASCII character 0x04
$ESC$ ASCII character 0x1B
$ETX$ ASCII character 0x03
$NAK$ ASCII character 0x15
$RS$ ASCII character 0x1E
$STX$ ASCII character 0x02
$CHECKSUM$ The TAP checksum
$CTRL$ Inserts the next character as a contorl code ($CTRL$Z inserts control-z)

The best way to write a script is to manualy log on to the GSM/PCN service providers SMS sending interface and send a message by hand.


Note:All software on this site is supplied "as is", with no guarantee offered or implied. While every effort has been made to ensure the correct operation of the software, no responsibility is accepted for any loss, damage or charges incurred which may arise from the use of this software. A virus scan has not been performed on the download files, you are advised to do this before running any of the software. Re-distribution of the software is permitted providing that I) no charge is made for it, II) it is distributed in exactly the same form as found on this site, III) you do not take any credit for it's production. Any queries should be directed to the original author.

© 2003 James Battersby.
Main Page | Mail the WebMaster