You are here:
ActiveXperts.com > SMS and MMS Toolkit > How to Use MMS Toolkit > SOAP (MM7) > 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 MMS using 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 objMm7Protocol Dim objMmsMessage Dim objMmsConstants Dim objMmsSlide
Create the MMS objects like this:
Set objMm7Protocol = CreateObject( "ActiveXperts.MmsProtocolMm7" ) Set objMmsMessage = CreateObject( "ActiveXperts.MmsMessage" ) Set objMmsConstants = CreateObject( "ActiveXperts.MmsConstants" ) Set objMmsSlide = CreateObject( "ActiveXperts.MmsSlide" )
Now, add the following lines to the file to have your fist MMS Toolkit VBScript program:
WScript.Echo "Version: " & objMm7Protocol.Version WScript.Echo "Expiration Date: " & objMm7Protocol.ExpirationDate
You can now send MMS messages.
The following VBScript code shows how to send a MMS message using a SOAP (MM7) connection:
Option Explicit Dim objMmsConstants, objMmsMessage, objMm7Protocol, objMmsSlide Set objMm7Protocol = CreateObject ( "ActiveXperts.MmsProtocolMm7" ) Set objMmsMessage = CreateObject ( "ActiveXperts.MmsMessage" ) Set objMmsSlide = CreateObject ( "ActiveXperts.MmsSlide" ) Set objMmsConstants = CreateObject ( "ActiveXperts.MmsConstants" ) ' MMSlide: Add duration, attachments(s) and text(s) objMmsSlide.Clear objMmsSlide.Duration = 10 'Display this screen for 10 seconds objMmsSlide.AddAttachment "logo.gif" objMmsSlide.AddText "The ActiveXperts logo" ' MmsMessage: Set properties objMmsMessage.Clear objMmsMessage.Subject = "MMS Message" objMmsMessage.AddRecipient AskRecipient() ' MmsMessage: Set advanced properties objMmsMessage.Class = objMmsConstants.asMMS_CLASS_PERSONAL objMmsMessage.Priority = objMmsConstants.asMMS_PRIORITY_HIGH ' MmsMessage: Add the slide created above. Note:You can add multiple slides objMmsMessage.AddSlide ( objMmsSlide ) ' MmsProtocolMm7: Set Provider objMm7Protocol.ProviderHost = "http://192.168.31.93:80/mm7" objMm7Protocol.ProviderAccount = "mm7" objMm7Protocol.ProviderPassword = "secret" ' MmsProtocolMm7: Set MM7 variation 3GPP / Ericsson / PAP objMm7Protocol.MM7Variation = objMmsConstants.asMMS_MM7VARIATION_3GPP ' MM7 Connection, optional, VASID and VASPID objMm7Protocol.VASID = "MMS" objMm7Protocol.VASPID = "ActiveXperts" ' MmsProtocolMm7: Set log file objMm7Protocol.LogFile = "mmslog.txt" ' MmsProtocolMm7: send now objMm7Protocol.Send ( objMmsMessage ) WScript.Echo "Send, result: " & objMm7Protocol.LastError & " (" & _ objMm7Protocol.GetErrorDescription ( objMm7Protocol.LastError ) & ")" & vbCrLf & _ "Provider response: " & objMm7Protocol.ProviderResponse & vbCrLf & _ "MessageID: " & objMm7Protocol.MessageId ' MmsProtocolMm7: ready WScript.Echo "Ready." ' *************************************************************************** ' Function AskRecipient ' *************************************************************************** Function AskRecipient Dim strRecipient Do strRecipient = inputbox( "Enter a recipient ( mobile number or e-mail address )", "Input" ) Loop until strRecipient <> "" AskRecipient = strRecipient End Function
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.