SMS - Short Message Service [is that right?] Probably -Zarutian
Does anyone have code to send text messages from a Tcl program to a cell phone?
Zarutian 26. may 2005: I wrote a little proc to send a SMS message to a cell phone sometime ago but I cant find it now. It was realy simple. It used an form on a cell phone provider's website. Mind you it could only send SMS message to Icelandic cell phones. Maybe I will figure it out again, during the weekend or after the weekend ;-)
A/AK 26-may-2005: gsm contains code for sending SMS message with a cell phone that must be connected to PC.
CellMessenger [L1 ] is a program for sending and receiving SMS, written in TCL. It's shareware, but its licence permits free code reuse.
These tools don't use any country- or operator-specific web forms, they work with a mobile phone via COM (RS-232), USB, or IrDA connection.
Zarutian 27. may 2005: But if you dont have an mobile phone handyly connected to your computer, a script that uses operator or country spefic web form(s) is better than nothing, yes?
A procedure, say called, send_SMS could switch on the country code of the phone number and then, if applieable, on operator/area prefix to find the correct webform to use.
Zarutian 29. september:
# these procedures havent been tested yet proc GSM_sendSMS {phonenumber text} { # the number must have international country code prefix package require http if {[string range $phonenumber 0 4] == "+354"} { switch -exact [GSM_which_Icelandic_provider?] { "OgVodafone" { # send the text message set token [http::geturl "http://www.ogvodafone.is/" -query \ [http::formatQuery "_ctl1:_oContentSection:_ctl4:txtTelno" [string range $phonenumber 4 end] \ "_ctl1:_oContentSection:_ctl4:txtSMS" [string range 0 96 $text]]] if {[http::ncode $token] != "200"} { error "couldnt send the message through free form on OgVodefone.is" } http::cleanup $token } default { set token [http::geturl "http://www.vit.is/spsms/?notmain=true" -query \ [http::formatQuery "txtSimanumer" [string range $phonenumber 4 end] \ "txtSkilabod" [string range $text 0 100]]] if {[http::ncode $token] != "200"} { error "couldnt sent the message through free form on vit.is" } http::cleanup $token } } } proc GSM_which_Icelandic_provider? {phonenumber} { package require tax if {[string range $phonenumber 0 4] == "+354"} { # find out if number is at OgVodafone or Landsíma Íslands set token [http::geturl "http://www.ogvodafone.is/index.aspx?GroupId=3784" -query \ [http::formatQuery "_ctl1:_oContentSection:_ctl1:txtMSISDN" [string range $phonenumber 4 end]]] if {[http::ncode $token] != "200"} { error "couldnt check wich company the number is at" } # todo: parse the result and set the variable company to "OgVodafone" or "Landsíminn" or "other" http::cleanup $token return $company } else { error "phonenumber doesnt start with +354 and therefore is probably not an Icelandic number" } }