The UK Home Automation Archive

Archive Home
Group Home
Search Archive


Advanced Search

The UKHA-ARCHIVE IS CEASING OPERATIONS 31 DEC 2024


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Text messaging from web url


  • To: <ukha_d@xxxxxxx>
  • Subject: Re: Text messaging from web url
  • From: "Alex Kinch" <alex@xxxxxxx>
  • Date: Wed, 2 Jul 2003 13:24:30 +0100
  • Mailing-list: list ukha_d@xxxxxxx; contact ukha_d-owner@xxxxxxx
  • References: <1057147093.376.54144.m12@xxxxxxx>
  • Reply-to: ukha_d@xxxxxxx

Hi Justin

Thanks for the script. I've made a few modifications:

- Changed 'Message = replace(SMSinfo(1)," ","&")'
to 'Message = SMSInfo(1)'.
Putting a "&" in the message field instead of a space was
causing the url
parser at the SendMyTxt end to assume it was another parameter, and
therefore it truncated the message after the first word.

- Added 'Case "ok" ReturnVal = "message sent
successfully"' to the 'Select
Case Result' bit, to stop successful message sending generating an error
(SendMyTxt returns "ok" if the message was sent).

Tested it on my Homeseer, seems to work ok!

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

SMSinfo = Split(Params,",")

Recipient = Trim(SMSinfo(0))
' Message = replace(SMSinfo(1)," ","&")
Message = SMSInfo(1)

PIN = "12345" 'Your sendmytxt.com PIN goes here
MyMobileNum = "1234567890" 'The mobile number you registered goes
here

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))

Select Case Result

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"

End Select

hs.writelog "SMS Info", "Sending message to: " &
Recipient
hs.writelog "SMS Info", "Message reads: " &
Replace(Message,"&"," ")
hs.writelog "SMS Info", "Service response: " &
ReturnVal
sms = ReturnVal
End Function

'***********************************************************************



----- Original Message -----

> Message: 19
>    Date: Wed,  2 Jul 2003 12:56:30 +0100
>    From: Justin <justin@xxxxxxx>
> Subject: Re: Re: Text messaging from web url
>
> Alex,
>
> I would suggest using a function in a HS script, this could be called
from
> other HS scripts or as a one-liner and saves the overhead of a plugin.
>
> Something like this should work. Just save it as a text file called
sms.txt in
> your HS scripts directory.
>
> Justin.
>
> '******************************************************************
> '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
>
> SMSinfo = Split(Params,",")
>
> Recipient = Trim(SMSinfo(0))
> Message = replace(SMSinfo(1)," ","&")
>
> PIN = "12345" 'Your sendmytxt.com PIN goes here
> MyMobileNum = "123456789" 'The mobile number you registered
goes here
>
> 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))
>
> Select Case Result
>
>   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 Else ReturnVal = "Unknown error"
>
> End Select
>
> hs.writelog "SMS Info", "Sending message to: "
& Recipient
> hs.writelog "SMS Info", "Message reads: " &
Replace(Message,"&"," ")
> hs.writelog "SMS Info", "Service response: " &
ReturnVal
>
> sms = ReturnVal
> End Function
>
>
'***********************************************************************
>
>
> Quoting kinchyuk <alex@xxxxxxx>:
>
> >
> > Justin,
> >
> > If you fancy modifying your app to interface to the sendmytxt
http
> > sending app (see my previous email) I'll be happy to put some
free
> > credits on your account. I've got HomeSeer too so can test it
from
> > this end.
> >
> > Alex
> >
> > --- In ukha_d@xxxxxxx, Justin <justin@g...> wrote:
> > > Paul,
> > >
> > > have you seen my old Nokia, PAYG SIM, HomeSeer, solution?
> > >
> > > http://tinyurl.com/ftdi
> > >
> > > Certainly more reliable than some of the online offerings, 2
way
> > SMS and it is
> > > cheaper than a GSM modem.
> > > Additionally, using my HS Commander plugin, it is possible
to have
> > other
> > > machines on a LAN send text messages as well.
> > >
> > > I chose this route as:
> > >
> > > I can send and receive text messages, even if net connection
is
> > down.
> > >
> > > Notification of power failure as HA PC is on UPS (which
talks to
> > HomeSeer) and
> > > the phone obviously has a battery.
> > >
> > > Burglar alarm notification, even if power and phone lines
are out.
> > >
> > >
> > > Justin.
>
>
>
________________________________________________________________________
>
________________________________________________________________________
>
>
>
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
>
>
>
>



Home | Main Index | Thread Index

Comments to the Webmaster are always welcomed, please use this contact form . Note that as this site is a mailing list archive, the Webmaster has no control over the contents of the messages. Comments about message content should be directed to the relevant mailing list.