Headwind SMS software products

About | Contact us

 
 

Headwind GSM Modem Driver integration

Common questions

How to create a VBScript script
Setup of a VBScript SMS handler
Setup of a VBScript SMS source
Connection with the database
Windows Scripting Host reference
VBScript Language Reference

Script examples

Send SMS from command line
Send SMS from file

Handler examples

Save messages in a database
Save messages in a text file
Simple autoresponder
Keyword-based autoresponder
Send SMS to E-mail

SMS source examples

Send SMS from DB tables
Send SMS from text file
Process monitoring
Host monitoring (ping)

Common questions

How to create a VBScript script

The script written in VBScript is an ordinary text file. Create a new text file in your file manager or in the Windows Explorer ("My Computer"), copy the code from this page to the file, and change the file extension to .vbs.

To view (and change) file extensions in Windows Explorer, select the menu item "Tools", "Folder options", tab "View", and uncheck the box "Hide extensions for registered file types".

The VBScript code is runned either from the file manager, or from the command line by the command cscript.exe (script name).

Setup of a VBScript SMS handler

  1. Open the control panel of Headwind GSM Modem Driver by double-clicking the icon in a system tray;
  2. Open the "Handlers" tab;
  3. Click the button "Add";
  4. Select the type "Command", the event to handle ("Receive" to handle received messages), type the handler command, and the directory where the command is runned (optional). If you are installing a VBScript handler, the command should begin from the interpreter name cscript.exe;
  5. To debug the handler, set the checkbox "Output result in log";
  6. Click "OK". The handler should appear in the list.

Setup of a VBScript SMS source

  1. Open the control panel of Headwind GSM Modem Driver by double-clicking the icon in a system tray;
  2. Open the "Sources" tab;
  3. Click the button "Add";
  4. Select the type "Command" and click "OK";
  5. Type the command called to get SMS messages and set the period of SMS source in seconds. If you are installing a VBScript source, the command should begin from the interpreter name cscript.exe;
  6. To debug the SMS source, set the checkbox "Output result in log";
  7. Click "OK". The SMS source should appear in the list.

Connection with the database

To use database in VBScript, you must use the class ADODB.Connection.

How to use ADODB.Connection in VBScript

For some types of databases, an additional installation of the database driver (connector) is necessary.

Download MySQL Connector

Example 1: write to MS Access database

Example 2: write to MySQL database

Example 3: write to MS SQL database

Script examples

Send SMS from command line

The script is called by the following command: cscript.exe script.vbs "(recipient)" "(message)"

Send SMS from file

Example 1: one message, multiple recipients

The file should have the following contents:
(message)
(recipient 1)
(recipient 2)
...

The script is called by the following command: cscript.exe script.vbs "(file)"

Example 2: multiple messages and multiple recipients

The file should have the following contents:
(recipient 1) (message 1)
(recipient 2) (message 2)
...

The script is called by the following command: cscript.exe script.vbs "(file)"

Handler examples

Save messages in a database

This scripts saves a message in the MySQL database. The table is created by the following SQL operator: CREATE TABLE inbox(date DATETIME, msisdn VARCHAR(255), sms VARCHAR(255)). Handler command: cscript.exe script.vbs "_FROM_" "_BODY_".

Save messages in a text file

Handler command: cscript handler_to_file.vbs _FROM_ "_BODY_" "C:\path\to\file.txt".

Simple autoresponder

Handler command: cscript.exe script.vbs "_FROM_" "_BODY_"

Keyword-based autoresponder

This script searches for keywords from a MySQL table. The table is created by the following SQL operator: CREATE TABLE keywords(keyword VARCHAR(255), reply VARCHAR(255)). Handler command: cscript.exe script.vbs "_FROM_" "_BODY_"

Send SMS to E-mail

This script requires Microsoft Outlook as well as Microsoft Outlook Collaboration Data Objects (CDO). Handler command: cscript.exe script.vbs "_FROM_" "_BODY_"

SMS source examples

Send SMS from DB tables

The name of the table for placing outgoing messages is outbox. This table has two field, addr and body (message recipient and body).

SMS source command: cscript.exe //Nologo script.vbs

Send SMS from text file

The file should have the following contents:
(recipient 1) (message 1)
(recipient 2) (message 2)
...

SMS source command: cscript.exe //Nologo script.vbs "(file)"

Process monitoring

This scripts check the presence of a process in the computer memory. If the process is absent, a SMS message is sent to the administrator. The SMS source is called by Headwind GSM Modem Driver with a given period. SMS source command: cscript.exe //Nologo script.vbs "(admin phone)" "(process.exe)".

Host monitoring (ping)

This script pings a host and sends a message to the administrator if the host fails to respond. The SMS source is called by Headwind GSM Modem Driver with a given period. SMS source command: cscript.exe //Nologo script.vbs "(phone)" "(host)" (for example, cscript.exe //Nologo script.vbs "18000000001" "sms.h-sms.com").