Download ActiveXperts SMS Messaging Server 4.1  (5828 KB - .exe file)
Send an SMS message using the SMS Messaging Server API - VBScript
SMS Messaging Server is an SMS messaging framework that enables companies to send, receive and process SMS- and e-mail messages. The framework is designed support virtually any scenario where low-and high volume SMS messaging is required. Use SMS Messaging Server in the following scenarios:
- Mobile users query a database; results are sent back via SMS or e-mail;
- Mobile users receive important information via SMS or e-mail while they are away from the office;
- Stock prices are sent automatically via SMS and/or e-mail, daily;
- Remote workers can update their worksheet from a remote location trough SMS;
- ICT administrators restart/reboot servers and/or daemons from remote by SMS;
- Setup an SMS voting system, supporting SMS and/or e-mail;
- Etc.
SMS Messaging Server can be well integrated into VBScript environments.
This document describes how the SMS Messaging Server can be integrated into VBScript projects.
Step 1: Download and install SMS Messaging Server
Download ActiveXperts SMS Messaging Server from the ActiveXperts Download Site and start the installation.
The installation guides you through the installation process.
Step 2: Create a new script
Create a new script using your favorite editor.
You can simply use notepad. However, a VBScript editor is recommended, so you can browse through objects, objects properties and object functions.
You're now able to write a more advanced VBScript program to create new messages.
Step 3: Create the SMS Messaging Server API objects
Create a new VBScript file called DEMO.VBS. It is recommended to insert the following line on top of your code:
Option Explicit
This statement requires that all variable names be defined (with the Dim statement),
to avoid simple typos that can cause incredible headaches and long debugging sessions for something that should have never happened.
Now, declare the MessageDB and Constants objects:
Dim objMessageDB
Dim objMessage
Dim objConstants
Create the MessageDB and Constants objects:
Set objMessageDB = CreateObject( "AxSmsServer.MessageDB" )
Set objConstants = CreateObject( "AxSmsServer.Constants" )
You should not create an instance of a Message yourself;
it is returned by functions like Create, FindFirstMessage, FindNextMessage and Load.
Step 4: Send an SMS (or e-mail) message
You can now send SMS and/or e-mail messages.
The following VBScript code shows how to send an SMS message:
Option Explicit
Dim objMessageDB, objMessage, objConstants
Dim numRecordID, strRecipient
' Create objects
Set objMessageDB = CreateObject( "AxSmsServer.MessageDB" )
Set objConstants = CreateObject( "AxSmsServer.Constants" )
' Open the Database
objMessageDB.Open
WScript.Echo "Open, result: " & objMessageDB.LastError
If( objMessageDB.LastError <> 0 ) Then
WScript.Quit
End If
' Create new Message in the Message Database
Set objMessage = objMessageDB.Create
WScript.Echo "Create, result: " & objMessageDB.LastError
If( objMessageDB.LastError = 0 ) Then
WScript.Echo "ID of the new message: " & objMessage.ID
' Modify the Message
objMessage.Direction = objConstants.MESSAGEDIRECTION_OUT
objMessage.Type = objConstants.MESSAGETYPE_SMS
objMessage.Status = objConstants.MESSAGESTATUS_PENDING
objMessage.ChannelID = 0 ' Any available channel capable of handling this message
objMessage.ScheduledTime = "" 'Immediate send
objMessage.Recipient = "+31625044454"
objMessage.Body = "SMS Messaging Server - VBScript Test SMS"
' Save the Message
objMessageDB.Save objMessage
WScript.Echo "Save, result: " & objMessageDB.LastError
End If
' Close the database
objMessageDB.Close
WScript.Echo "Message Dastabase closed."
WScript.Echo "Ready."
ActiveXperts SMS Messaging Server is a messaging framework to send and receive email and SMS messages.
Use the API to create new messages from various development platforms,
including Visual Basic .NET, Visual CSharp .NET,
ASP .NET (VB,CS),
ASP,
Visual Basic,
Visual Studio/Visual C++,
Delphi,
PHP,
HTML,
VBScript and any other ActiveX/COM compliant platform. SMS Messaging Server is an ActiveXperts Software B.V. Product.
|