[Date Prev][Date
Next][Thread Prev][Thread Next][Date
Index][Thread Index]
RE: Updated SendMyTxt SMS script for Homeseer
- To: <ukha_d@xxxxxxx>
- Subject: RE: Updated SendMyTxt SMS script for Homeseer
- From: "Justin" <justin@xxxxxxx>
- Date: Thu, 3 Jul 2003 19:30:55 +0100
- Mailing-list: list ukha_d@xxxxxxx; contact
ukha_d-owner@xxxxxxx
- Reply-to: ukha_d@xxxxxxx
Here you are Alex..
hs.sendemail ToEmail, FromEmail, "Low SMS credit warning" ,
"You have " &
ResultCedits & " SMS credits remaining."
Justin.
> -----Original Message-----
> From: Alex Kinch [mailto:alex@xxxxxxx]
> Sent: 03 July 2003 4:41 PM
> To: ukha_d@xxxxxxx
> Subject: [ukha_d] Updated SendMyTxt SMS script for Homeseer
>
>
>
> Hello,
>
> Here's an updated Homeseer script, which will allow you to send text
> messages through the SendMyTxt http->sms gateway.
>
> It now logs the amount of text credits remaining, and will alert you
when
> the threshhold (which you can set) is reached.
>
> However.. the only thing I haven't done is written the bit of code to
send
> an email, as I've only been doing Homeseer scripting for the last
> day or so.
> Can someone kindly add it in?
>
> Thanks,
>
> Alex
>
> '******************************************************************
> 'Script to send SMS messages using the sendmytxt.com service
>
> 'Call this function from your scripts or as a one-liner like this:
> 'hs.RunEx "sms.txt","SMS","RECIPIENT
NUMBER","TXTMESSAGE"
> 'e.g. hs.RunEx
"sms.txt","sms","123456789,Hello World"
>
> Function sms(Params)
>
> Dim MyMobileNum, PIN, Recipient, Message, host, page, Result,
ResultCode,
> ResultCredits, CreditThreshold, FromEmail, ToEmail
>
> SMSinfo = Split(Params,",")
>
> Recipient = Trim(SMSinfo(0))
> Message = SMSInfo(1)
>
> '
>
#########################################################################
> ' # MAKE SURE YOU CHANGE THE FOLLOWING LINES BELOW!
> #
> '
>
#########################################################################
>
> PIN = "1234" 'Your sendmytxt.com PIN goes here
> MyMobileNum = "1234567890" 'The mobile number you registered
goes here
> CreditThreshold = 5 ' Below this number, email is sent advising of low
> credits
> FromEmail = "me@myplace"
> ToEmail = "you@wherever"
>
>
> '
>
#########################################################################
> ' # DO NOT CHANGE ANYTHING BELOW THIS LINE
> #
> '
>
#########################################################################
>
> host = "sendmytxt.com"
> page = "/app/httpsend.asp?"
> page = page & "from=" & MyMobileNum &
"&to=" & Recipient & "&pin=" & PIN
> page = page & "&message=" & Message
> strip_tags = false 'true
> port = 80
>
>
> Result = Trim(hs.GetURL(host, page, strip_tags, port))
> ResultCode = Left(Result,2)
> ResultCredits = Right(Result,Len(Result)-3)
>
> Select Case ResultCode
>
> Case "0" ReturnVal = "No from number or pin
entered"
> Case "-1" Returnval = "from number not a registered
user"
> Case "-2" ReturnVal = "incorrect pin"
> Case "-3" ReturnVal = "account suspended"
> Case "-4" ReturnVal = "insufficient credits"
> Case "-5" ReturnVal = "message sending failed"
> Case "-6" ReturnVal = "format of to number not
recognised"
> Case "-7" ReturnVal = "format of from number not
recognised"
> Case "ok" ReturnVal = "message sent successfully"
>
> Case else ReturnVal = "Unknown response."
>
> End Select
>
> If ResultCredits < CreditThreshhold then
>
hs.sendemail ToEmail, FromEmail, "Low SMS credit warning" ,
"You have " &
ResultCedits & " remaining." & vbcrlf & " You
can top-up your credits by
visiting www.sendmytext.com"
>
> End If
>
> hs.writelog "SMS Info", "Sending message to: "
& Recipient
> hs.writelog "SMS Info", "Message reads: " &
Message
> hs.writelog "SMS Info", "Service response: " &
ReturnVal
> hs.writelog "SMS Info", "Credits remaining: "
& ResultCredits
> sms = ReturnVal
> End Function
Home |
Main Index |
Thread Index
|