AxSms.Snpp
Introduction
Skip to properties and methods
With Auron SMS Component Pager messages can be sent through SNPP. SNPP (Simple Network Paging Protocol) is a standard for sending wireless messages to paging devices. SNPP provides a simple way to make a link between the Internet and a SNPP compliant paging terminal.
Page using SNPP
Sending a pager message through the SNPP protocol.
Set objSnpp = CreateObject("AxSms.Snpp") ' Create Snpp instance
Wscript.Echo "SMS Component Version " & objSnpp.Version & "; Build " & _
objSnpp.Build & "; Module " & objSnpp.Module
WScript.Echo "License Status: " & objSnpp.LicenseStatus & vbCrLf
objSnpp.Server = "snpp.pageallcom.com"
objSnpp.ServerPort = 444
objSnpp.ServerTimeout = 2500 ' Set timeout to 2500 msecs
objSnpp.Send("5551234", Hello, World!) ' Send the pager message
WScript.Echo "Send, result; " & objSnpp.LastError
WScript.Echo "Last response from SNPP provider: " & objSnpp.ProviderResponse
How to run this example
Properties and Methods
Property | Type | Read/Write | Description |
Version | String | Read | Version number of the SMS Component |
Build | String | Read | Build number of the SMS Component |
Module | String | Read | Module name of the SMS Component |
LicenseStatus | String | Read | License Status |
LicenseKey | String | Read/Write | License Key |
LastError | Number | Read | Result of the last called method |
LogFile | String | Read/Write | The path to a logfile which can be used for troubleshooting |
MultilineEnabled | Boolean | Read/Write | Enable or disable sending multiline messages |
Server | String | Read/Write | SNPP server host name or IP Address |
ServerPort | String | Read/Write | SNPP server TCP port. Default: 444 |
ServerTimeout | String | Read/Write | SNPP server command timeout in milliseconds. Default: 2000 milliseconds |
ProviderUsername | String | Read/Write | Optional username used by SNPP provider |
ProviderPassword | String | Read/Write | Optional password used by SNPP provider |
ProviderResponse | String | Read | Last response from provider |
Method | Description |
Clear | Reset all properties to their default values |
GetErrorDescription | Get the description of the given error |
Sleep | Sleep for the specified number of milliseconds |
Send | Send a Pager message |
SaveLicenseKey | Save the License Key in the registry |
Version property
Return the version number of the SMS Component
Example:
Set objSnpp = CreateObject("AxSms.Snpp")
WScript.Echo "SMS Component Version " & objSnpp.Version & "; Build " & _
objSnpp.Build & "; Module " & objSnpp.Module
WScript.Echo "License Status: " & objSnpp.LicenseStatus & vbCrLf
...
Build property
Return the build number of the SMS Component.
Example:
Set objSnpp = CreateObject("AxSms.Snpp")
WScript.Echo "SMS Component Version " & objSnpp.Version & "; Build " & _
objSnpp.Build & "; Module " & objSnpp.Module
WScript.Echo "License Status: " & objSnpp.LicenseStatus & vbCrLf
...
Module property
Return the module name of the SMS Component.
Example:
Set objSnpp = CreateObject("AxSms.Snpp")
WScript.Echo "SMS Component Version " & objSnpp.Version & "; Build " & _
objSnpp.Build & "; Module " & objSnpp.Module
WScript.Echo "License Status: " & objSnpp.LicenseStatus & vbCrLf
...
LicenseStatus property
The status of your license. In case you have not licensed the product, the property holds the trial expiration date. For details, see Product Activation.
Example:
Set objSnpp = CreateObject("AxSms.Snpp") ' Create new instance
WScript.Echo "License Status: " & objSnpp.LicenseStatus
WScript.Echo "License Key: " & objSnpp.LicenseKey
LicenseKey property
A license key is required to unlock this component after the trial period has expired. Assign the LicenseKey property every time a new instance of this component is created (see code below). Alternatively, the LicenseKey property can be set automatically. This requires the license key to be stored in the registry. For details, see Product Activation.
Example:
Set objSnpp = CreateObject("AxSms.Snpp") ' Create new instance
objSnpp.LicenseKey = "XXXXX-XXXXX-XXXXX" ' Assign your license key
WScript.Echo "LicenseKey: " & objSnpp.LicenseKey
LastError property
Completion code of the last called method. To find the error description of a given error code, go to the online error codes codes page.
Example:
Set objSnpp = CreateObject("AxSms.Snpp")
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
objSnpp.SendSms objMessage
WScript.Echo "Send SMS result: " & objSnpp.LastError ' Is our message sent ?
...
LogFile property
By default, LogFile holds an empty string and nothing is logged. If a valid file name is assigned to it, the SMS Component will write debug information to this file. Output data is written at the end of the file, the file is not cleared.
Example:
Set objSnpp = CreateObject("AxSms.Snpp")
objSnpp.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
objSnpp.SendSms objMessage
...
MultilineEnabled property
Enable or disable sending multiline messages.
With multiline enabled the SNPP component will send the message using the less commonly supported ‘DATA’ command. With multiline disabled the SNPP component will send the message using the more commonly supported ‘MESS’ command.
Toggle this property if there are problems with sending messages to older SNPP enabled equipment or providers.
Example:
Set objSnpp = CreateObject(AxSms.Snpp")
objSnpp.MultilineEnabled = False
...
objSnpp.Send( .. )
Server property
Sets the host name or TCP/IP address of the SNPP server provider.
Example:
Set objSnpp = CreateObject(AxSms.Snpp")
objSnpp.Server= "snpp.pageallcom.com"
...
objSnpp.Send( .. )
ServerPort property
Sets the TCP port for the SNPP connection. This property is optional, the default value is 444.
Example:
Set objSnpp = CreateObject("AxSms.Snpp")
objSnpp.Server= "snpp.pageallcom.com"
objSnpp.ServerPort = 4040
...
objSnpp.Send( .. )
ServerTimeout property
Maximum time (in milliseconds) before a Send operation will timeout. Default value: 2000 milliseconds.
Example:
Set objSnpp = CreateObject("AxSms.Snpp")
objSnpp.Server= "snpp.pageallcom.com"
objSnpp.ServerTimeout = 5000
...
objSnpp.Send( .. )
ProviderUsername property
The username to be used with the provider
Example:
Set objSnpp = CreateObject("AxSms.Snpp")
strRecipient = 5551234
strMessage = "Hello World !!!"
objSnpp.Server = "snpp.pageallcom.com"
objSnpp.ServerPort = 444
objSnpp.ProviderUsername = "secretuser"
objSnpp.ProviderPassword = "secret"
objSnpp.Send( strRecipient, strMessage )
WScript.Echo "Send, result; " & objSnpp.LastError
WScript.Echo "Last response from SNPP provider: " & objSnpp.ProviderResponse
ProviderPassword property
The password to be used with the provider.
Example:
Set objSnpp = CreateObject("AxSms.Snpp")
strRecipient = 5551234
strMessage = "Hello World !!!"
objSnpp.Server = "snpp.pageallcom.com"
objSnpp.ServerPort = 444
objSnpp.ProviderPassword = "secret"
objSnpp.Send( strRecipient, strMessage )
WScript.Echo "Send, result; " & objSnpp.LastError
WScript.Echo "Last response from SNPP provider: " & objSnpp.ProviderResponse
ProviderResponse property
The last response from the provider. You can use this property for troubleshooting purposes. The property is read-only; you cannot assign a value to it.
Example:
Set objSnpp = CreateObject("AxSms.Snpp")
strMessage = 5551234
strRecipient = "Hello World !!!"
objSnpp.Server = "snpp.pageallcom.com"
objSnpp.ServerPort = 444
objSnpp.ProviderPassword = "secret"
objSnpp.Send(strRecipient, strMessage)
WScript.Echo "Send, result; " & objSnpp.LastError
WScript.Echo "Last response from SNPP provider: " & objSnpp.ProviderResponse
Clear method
This method resets all properties to their default values.
Parameters:
- None
Return value:
Always 0.
Example:
Set objSnpp = CreateObject("AxSms.Snpp")
....
objSnpp.Clear
...
GetErrorDescription method
GetErrorDescription provides the error description of a given error code.
Parameters:
- The error code
Return value:
The error string.
Example:
Set objSnpp = CreateObject("AxSms.Snpp")
objSnpp.LogFile = "C:\temp\log.txt"
...
Set objMessage = CreateObject("AxSms.Message")
objMessage.ToAddress = "+31611223344"
objMessage.Body = "Short text message"
objSnpp.SendSms objMessage
WScript.Echo "SendSms result: " & objSnpp.LastError & ", " & _
objSnpp.GetErrorDescription(objSnpp.LastError)
Sleep method
This method suspends the current thread for the specified number of milliseconds.
Parameters:
- Milliseconds to sleep
Return value:
Always 0.
Example:
Set objSnpp = CreateObject("AxSms.Snpp")
....
objSnpp.Sleep 1000
...
Send method
Deliver the message to the SMSC provider. The SMSC provider will send the SMS message to the recipient
Parameters:
- Recipient
- Message
Return value:
Always 0.
Example:
Set objSnpp = CreateObject("AxSms.Snpp")
strRecipient = 5551234
strMessage = "Hello World !!!"
objSnpp.Server = "snpp.pageallcom.com"
objSnpp.ServerPort = 444
objSnpp.ProviderPassword = "secret"
objSnpp.Send(strRecipient, strMessage)
WScript.Echo "Send, result; " & objSnpp.LastError
WScript.Echo "Last response from SNPP provider: " & objSnpp.ProviderResponse
SaveLicenseKey method
Description:
Use SaveLicenseKey to store the license key permanently in the registry. When a license key is saved, it is restored automatically every time a new instance of the object (‘Snpp’) is created. It is not recommended to save the license key if you distribute the component with your own software, because the key can be easily used by others.
Parameters:
- None.
Return value:
Always 0. Check LastError property to see if the method was completed successfully.
Example:
Set objSnpp = CreateObject("AxSms.Snpp") ' Create new instance
objSnpp.LicenseKey = "XXXXX-XXXXX-XXXXX"
objSnpp.SaveLicenseKey ' Save license key to registry
For more information, see Product Activation.