You are here:
ActiveXperts.com > SMS and MMS Toolkit > How to Use the SMS and MMS Toolkit > HTTP/SMS > VBScript
Quicklinks
The SMS and MMS Toolkit is a software development kit (SDK) to enhance an application or script with SMS, MMS and Pager functionality. SMS messages can be sent using a GSM/GPRS modem, an SMPP provider, an HTTP compliant SMS provider or using a standard dialup or fixed-line SMS modem. MMS messages can be sent via a GSM/GPRS modem (MM1), an SMTP server (MM4) or an XML/SOAP compliant provider (MM7).
SMS features:
MMS features:
Pager features:
This document describes how the SMS and MMS Toolkit can be integrated into VBScript projects.
Download the SMS and MMS Toolkit from the ActiveXperts Download Site and start the installation. The installation guides you through the installation process.
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 script to send/receive SMS using SMS and MMS Toolkit.
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 SMS and MMS Toolkit objects:
Dim objHttpProtocol Dim objSmsMessage Dim objSmsConstants
Create the objects like this:
Set objHttpProtocol = CreateObject( "ActiveXperts.SmsProtocolHttp" ) Set objSmsMessage = CreateObject( "ActiveXperts.SmsMessage" ) Set objSmsConstants = CreateObject( "ActiveXperts.SmsConstants" )
Now, add the following lines to the file to have your fist SMS and MMS Toolkit VBScript program:
WScript.Echo "Version: " & objHttpProtocol.Version WScript.Echo "Expiration Date: " & objHttpProtocol.ExpirationDate
You can now send and/or receive SMS messages.
The following VBScript code shows how to send a SMS message using an HTTP Based SMS solution provider:
Option Explicit Dim objHttpProtocol, objSmsMessage, objSmsConstants Dim strRecipient Set objHttpProtocol = CreateObject ( "ActiveXperts.SmsProtocolHttp" ) Set objSmsMessage = CreateObject ( "ActiveXperts.SmsMessage" ) Set objSmsConstants = CreateObject ( "ActiveXperts.SmsConstants" ) Wscript.Echo "ActiveXperts SMS and MMS Toolkit " & objHttpProtocol.Version & " demo." Wscript.Echo "Expiration date: " & objHttpProtocol.ExpirationDate & vbCrLf ' Set Logfile objHttpProtocol.LogFile = "SmsProtocolHttp.log" ' Provider Settings objHttpProtocol.ProviderHost = "post.activexperts-labs.com" objHttpProtocol.ProviderPort = 8080 ' Proxy Server Settings ( optional ) ' objHttpProtocol.ProxyServer = "MyProxyServer" ' objHttpProtocol.ProviderAccount = "MyAccount" ' objHttpProtocol.ProviderPassword = "MyPassword" ' Provider Response templates objHttpProtocol.ProviderErrorResponse = "ERR" ' Response should NOT contain 'ERR' objHttpProtocol.ProviderSuccessResponse = "id" ' Response should contain 'id' ' URL Templates objHttpProtocol.URLText = "/sendsms/default.asp?username=AX008&password=812056&text=%MESSAGEDATA%&to=%MESSAGERECIPIENT%&from=%MESSAGESENDER%" objHttpProtocol.URLBinary = "/sendsms/default.asp?username=AX008&password=812056&text=%MESSAGEDATA%&to=%MESSAGERECIPIENT%&from=%MESSAGESENDER%&data=1" objHttpProtocol.URLUnicode = "/sendsms/default.asp?username=AX008&password=812056&text=%MESSAGEDATA%&to=%MESSAGERECIPIENT%&from=%MESSAGESENDER%&unicode=1" ' SMS Message Properties objSmsMessage.Data = "ActiveXperts SMS and MMS Toolkit HTTP/SMS Demo" objSmsMessage.Sender = "+31638740160" objSmsMessage.Format = objSmsConstants.asMESSAGEFORMAT_TEXT ' Set recipient Do strRecipient = inputbox( "Enter the recipients phone number." & vbCrLf & "( Use international number format. )", "Input" ) Loop until strRecipient <> "" objSmsMessage.Recipient = strRecipient objHttpProtocol.Send( objSmsMessage ) WScript.Echo "Send: ERROR#" & objHttpProtocol.LastError & " (" & objHttpProtocol.GetErrorDescription ( objHttpProtocol.LastError ) & ")" WScript.Echo "Response: " & objHttpProtocol.ProviderResponse
There are many working samples included with the product. You can also find them on the ActiveXperts FTP site: ftp.activexperts-labs.com/samples/mobile-messaging-component.