how to make a command like "email" just that it sends SMS
Im making a personal sms sender for ubiquity, and need some help...
the thing i want to do is:
- have to type in: sms "text to sms" to "phone-number"
and press enter, and done. sms sent
This is what i have made:
name: "sms",
takes: {"sms": noun_arb_text},
preview: function( pblock, theSearch ) {
pblock.innerHTML = "Will SMS: " + theSearch.text;
},
execute: function( theSearch ) {
var msg = theSearch.text + "Whrite sms now";
var url = "https://www.gulesider.no/mypage/sendSms.c?recipients=" + theSearch.text;
Utils.openUrlInBrowser( url );
displayMessage( msg );
But this wil only bring me to the page shown in the image.
so how can i make it subit my message at the same time?
here is the important html for the sms page:(full html at bottom)
<form name="sendSmsForm">
<h1>Send SMS </h1>
Du har 51 SMS til gode
<table class="skjematabell">
<tr>
<th>Avsender</th>
<td>
<select name="sender">
</select><option value="48069930">
480 69 930
</option>
<option value="tlf.no">
tlf.no
</option>
Legg til eget nummer
</td>
</tr>
<tr>
<th>Send til mobilnummer</th>
<td>
<input name="recipients" class="txtnpt" type="text" value="90635939" />
</td>
</tr>
<tr>
<th>Tekst</th>
<td>
<textarea name="text"></textarea>
Meldingens lengde: 0 (maks. 459)
Belastes 1 SMS
</td>
</tr>
</table></form>
<input name="submit" class="submit" type="submit" value="Send" />
FULL:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta name="Description" />
<meta name="keywords" />
<meta />
<meta />
<meta />
<meta />
<meta name="SKYPE_TOOLBAR" />
<title>
Telefonkatalogen™ Min Side
</title>
<link href="/css/minside/stilsett.css" rel="stylesheet" type="text/css" />
</head>
</html><body>
<h2>Mine lenker</h2>
Endre lenker
</body>
<h2>Velkommen til Min side!</h2>
Fått e-post fra Telefonkatalogen? Bare nysgjerrig? Les
mer om endring av oppføring og priser.
<form name="sendSmsForm">
<h1>Send SMS </h1>
Du har 51 SMS til gode
<table class="skjematabell">
<tr>
<th>Avsender</th>
<td>
<select name="sender">
</select><option value="48069930">
480 69 930
</option>
<option value="tlf.no">
tlf.no
</option>
Legg til eget nummer
</td>
</tr>
<tr>
<th>Send til mobilnummer</th>
<td>
<input name="recipients" class="txtnpt" type="text" value="48069930" />
</td>
</tr>
<tr>
<th>Tekst</th>
<td>
<textarea name="text"></textarea>
Meldingens lengde: 0 (maks. 459)
Belastes 1 SMS
</td>
</tr>
</table>
<input name="submit" class="submit" type="submit" value="Send" />
Din SMS konto vil bli belastet med én SMS per delmelding.
</form>
<!--See Bug # 9027 -->
<noscript>
</noscript>
<!-- End TNSMetrix -->
<noscript>
</noscript>
<!--//-->
<!-- End of IndexTools Code -->
the thing i want to do is:
- have to type in: sms "text to sms" to "phone-number"
and press enter, and done. sms sent
This is what i have made:
name: "sms",
takes: {"sms": noun_arb_text},
preview: function( pblock, theSearch ) {
pblock.innerHTML = "Will SMS: " + theSearch.text;
},
execute: function( theSearch ) {
var msg = theSearch.text + "Whrite sms now";
var url = "https://www.gulesider.no/mypage/sendSms.c?recipients=" + theSearch.text;
Utils.openUrlInBrowser( url );
displayMessage( msg );
But this wil only bring me to the page shown in the image.
so how can i make it subit my message at the same time?
here is the important html for the sms page:(full html at bottom)
<form name="sendSmsForm">
<h1>Send SMS </h1>
Du har 51 SMS til gode
<table class="skjematabell">
<tr>
<th>Avsender</th>
<td>
<select name="sender">
</select><option value="48069930">
480 69 930
</option>
<option value="tlf.no">
tlf.no
</option>
Legg til eget nummer
</td>
</tr>
<tr>
<th>Send til mobilnummer</th>
<td>
<input name="recipients" class="txtnpt" type="text" value="90635939" />
</td>
</tr>
<tr>
<th>Tekst</th>
<td>
<textarea name="text"></textarea>
Meldingens lengde: 0 (maks. 459)
Belastes 1 SMS
</td>
</tr>
</table></form>
<input name="submit" class="submit" type="submit" value="Send" />
FULL:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta name="Description" />
<meta name="keywords" />
<meta />
<meta />
<meta />
<meta />
<meta name="SKYPE_TOOLBAR" />
<title>
Telefonkatalogen™ Min Side
</title>
<link href="/css/minside/stilsett.css" rel="stylesheet" type="text/css" />
</head>
</html><body>
<h2>Mine lenker</h2>
- Søketjenester
- Nyheter
- Sport og friluftsliv
- N3Sport
- Fri Flyt
- Sykling.no
- Trening.no
- Golf.no
- Alltid Fotball
- Kampsport Forbundet
- Turistforeningen
- Inatur
- Reise
- Underholdning
- Nyttig
- Telefonkatalogen
- Forbrukerombudet
- Forbruker.no
- Nettvett
- DinSide
- Ordbok
- Apéritif
- Wikipedia
- Valutakurs
- Lommelegen
- Offentlig
- Kjøp og salg
Endre lenker
</body>
<h2>Velkommen til Min side!</h2>
Fått e-post fra Telefonkatalogen? Bare nysgjerrig? Les
mer om endring av oppføring og priser.
<h1>Send SMS </h1>
Du har 51 SMS til gode
<table class="skjematabell">
<tr>
<th>Avsender</th>
<td>
<select name="sender">
</select><option value="48069930">
480 69 930
</option>
<option value="tlf.no">
tlf.no
</option>
Legg til eget nummer
</td>
</tr>
<tr>
<th>Send til mobilnummer</th>
<td>
<input name="recipients" class="txtnpt" type="text" value="48069930" />
</td>
</tr>
<tr>
<th>Tekst</th>
<td>
<textarea name="text"></textarea>
Meldingens lengde: 0 (maks. 459)
Belastes 1 SMS
</td>
</tr>
</table>
<input name="submit" class="submit" type="submit" value="Send" />
Din SMS konto vil bli belastet med én SMS per delmelding.
</form>
<!--See Bug # 9027 -->
<noscript>
<!-- End TNSMetrix -->
<noscript>
</noscript>
<!--//-->
<!-- End of IndexTools Code -->
1
person has this question
I have this question, too!
Tell me when someone answers.
The more people who ask this question, the more it gets noticed.
The more people who ask this question, the more it gets noticed.
-
Inappropriate?It was NOT necessary to paste the entire HTML in. You don't need to bother with the page HTML at all, in fact. Please do some research on POST requests, and on jQuery. Find out how this web page is currently POSTing SMS messages (try the Live HTTP Headers plugin for Firefox), and then use jQuery to duplicate the POST.
2 people say
this answers the question
-
Inappropriate?ok, thanks, so i've made it better, but i dont know how to define "mytext" and therefore, "undefined" is sent instead of my text.
CmdUtils.CreateCommand({
name: "date",
homepage: "www.theworldwebwide.now",
author: { name: "Nicolas Tonne", email: "nixolas1@hotmail.com"},
contributors: ["Nicolas Tonne, Dustin Calhoun"],
license: "ALL",
name: "sms",
takes: {" to ": noun_arb_text},
icon: "http://freesms.no/favicon.ico",
preview: function( pblock, theSearch , mytext) {
pblock.innerHTML = " Send a sms to " + theSearch.text + " saying " + mytext.text;
},
execute: function( theSearch, mytext ) {
var msg = "say " + mytext.text + " to " + theSearch.text;
var url = "https://www.gulesider.no/mypage/sendSms.c?&sender=48069930&recipients=" + theSearch.text + "&text=" + mytext.text + "&submit=send";
Utils.openUrlInBrowser( url );
displayMessage( msg );
}
})
I’m different
-
Inappropriate?Writing commands (like yours) with multiple arguments is explained in the tutorial.
-
Inappropriate?thanks, now i get the text in too... the only thing left is to connect nickname with number; like: home = 22753245, and to send it intantly(with jQuery)
what i have now:
CmdUtils.CreateCommand({
name: "sms",
takes: {"nummer": noun_arb_text},
modifiers: {med: noun_arb_text},
preview: function( pblock, nummer, mods ) {
var msg = 'sms "${nummer}" med ${med}.';
var subs = {nummer: nummer.text, med: mods.med.text};
pblock.innerHTML = CmdUtils.renderTemplate( msg, subs );
},
execute: function( nummer, mods ) {
var msg = "sier " + mods.med.text + " til " + nummer.text;
var url = "https://www.gulesider.no/mypage/sendSms.c?&sender=48069930&recipients=" + nummer.text + "&text=" + mods.med.text + "&submit=send";
Utils.openUrlInBrowser( url );
displayMessage( msg );
}
});
I’m close to the finnish line
-
Inappropriate?Don't know if this is still a problem, but I got it working by using a jQuery post instead of the Utils.openUrlInBrowser function:
var url = "https://www.gulesider.no/mypage/sendSms.c";
var data = "sender=48069930&recipients=" + nummer.text
+ "&text=" + mods.med.text + "&submit=Send";
jQuery.post( url, data );
1 person says
this answers the question
-
A good idea, you really got it working(sent a message)? when i try it, it just closes, and shows the message. But thanks anyway, i will try to fix it.
EDIT: Yes i fixed it! i had done some modifications to the mods.med.text to mods.og.text , so fixed it and it worked smoothely ;-) thanks. -
Inappropriate?So, for everyone wanting to send free sms(in norway), here is the complete script: http://www.hurl.ws/ipi you will need to edit the nicknames and phone numbers, as well as the number it will be sent from
I’m happy
Loading Profile...






