Message Method

Description:

The Message method returns the value of each Message item in the Inbox collection object. Each Message item can be enumerated by using the 'For...Each' loop or by passing the index of individual message item.

   

Usage Set objMessage = ObjectName.Inbox.Message
OR
strPhone = ObjectName.Inbox.Message(Index).Phone
strText = ObjectName.Inbox.Message(Index).Text
varTimeStamp = ObjectName.Inbox.Message(Index).TimeStamp
strTimeStampRFC = ObjectName.Inbox.Message(Index).TimeStampRFC
strSMSC = ObjectName.Inbox.Message(Index).SMSC
blnResult = ObjectName.Inbox.Message(Index).Delete
Parameters Index (to delete the message item or to access it's properties)
Returns The Message Item object
Remarks
  • Message is the default method of Inbox collection i.e. ObjectName.Inbox.Message(Index) is same as ObjectName.Inbox(Index) 
  • After calling the Delete method, the messages are rearranged in the Inbox. The messages which had Index greater than the index of the deleted message are reduced by 1.

Usage Example:

Visual Basic / ASP (VBScript)
Dim objSMS As mCore.SMS, i As Integer, Message As Message
Set objSMS = New mCore.SMS
' You can also use Set objSMS = CreateObject("mCore.SMS")
' In case of ASP (VBScript) to create object use
' Set objSMS = Server.CreateObject("mCore.SMS")
' In ASP use Response.Write instead of MsgBox
objSMS.Port = "COM2"
objSMS.BaudRate = 57600
objSMS.Parity = "N"
objSMS.DataBits = 8
objSMS.StopBits = "1"
objInbox.Concatenate = True
objSMS.MessageMemory = "SM"
objSMS.Inbox.Refresh
If objSMS.Inbox.HasMessages Then
     MsgBox "Total " & objSMS.Inbox.Count & " incoming messages!"
     For Each Message In objSMS.Inbox
          MsgBox Message.TimeStampRFC & vbCrLf & "From: " & _
           Message.Phone & vbCrLf & Message.Text
     Next
     ' The following code also generates the same result as above
     For i = 1 To objSMS.Inbox.Count
          MsgBox objSMS.Inbox.Message(i).TimeStampRFC & vbCrLf & _
           "From: " & objSMS.Inbox.Message(i).Phone & vbCrLf & _
           objSMS.Inbox.Message(i).Text
     Next
End If
Set objSMS = Nothing

  

Copyright © IG Logix Softech Pvt Ltd, All Rights Reserved