VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Send SMS message through a cellular mobile phone, for instance nokia or ericsson, using Hayers AT c

by Anonymous (267 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Sun 7th September 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Send SMS message through a cellular mobile phone, for instance nokia or ericsson, using Hayers AT commands

Rate Send SMS message through a cellular mobile phone, for instance nokia or ericsson, using Hayers AT c



' You need the freeware AComport.dll to run the sample.
' Download it from http://www.vahland.com/pub/acomport.dll
' and register it on your machine.
' Read http://www.vahland.com/pub/acomport.htm for more info

Const acERR_SUCCESS = 0

' --------------------------------------------------------------
Sub WriteStr( o, str )
    o.WriteString str
    WScript.Echo "-> " & str
End Sub
' --------------------------------------------------------------
Sub ReadStr( o )
    str = "notempty"
    o.Sleep 200
    Do While str <> ""
        str = o.ReadString
        WScript.Echo "<- " & str
    Loop
End Sub
' --------------------------------------------------------------

WScript.Echo "Be sure to have the FREEWARE AComport.dll registered on your system"
WScript.Echo "Check out the code header about how to obtain the component."

Set acObj = CreateObject( "ActivXperts.Comport" )

acObj.Baudrate = 19200
acObj.PortID = 1
acObj.Open
WScript.Echo "acObj.Open, result: " & acObj.LastError

If acObj.LastError = acERR_SUCCESS Then

    WriteStr acObj, "at+cmgf=1"
    ReadStr acObj

    Do
       strNumber = inputbox("Enter the recipients phone number", "Input")
    loop until strNumber <> Chr (13)

    Do
       strMessage = inputbox("Enter the message body text", "Input" )
    loop until strMessage <> Chr (13)

    WriteStr acObj, "at+cmgs=""" & strNumber & """
    ReadStr acObj

    WriteStr acObj, strMessage

    strTermCmd = Chr( 26 ) ' Terminate message by sending [ctrl]z followed by an [enter]
    WriteStr acObj, strTermCmd
    ReadStr acObj
    
    acObj.Close

End If

Download this snippet    Add to My Saved Code

Send SMS message through a cellular mobile phone, for instance nokia or ericsson, using Hayers AT c Comments

No comments have been posted about Send SMS message through a cellular mobile phone, for instance nokia or ericsson, using Hayers AT c. Why not be the first to post a comment about Send SMS message through a cellular mobile phone, for instance nokia or ericsson, using Hayers AT c.

Post your comment

Subject:
Message:
0/1000 characters