Page 1 of 1
sms script (voipbuster)
Posted: Sat Jul 07, 2012 6:10 pm
by mrqnapper
I have this script for having homeseer sensing an sms alert with use off voipbuster.
Code: Select all
Sub Main
strUserName = "domoticaforum"
strPassword = "thispasswordfortest"
strPhoneNumber = "+31652666531"
strMessage = "ALERT"
If strMessage <> "" Then
result = hs.urlaction("https://voipbuster.com/myaccount/sendsms.php?username=" _
& strUserName & "&password=" & strPassword & "&from=" & strUserName & "&to=" _
& strPhoneNumber & "&text=" & strMessage, "GET", "", "")
End If
End Sub
When testing I get an error saying : script compile erro de naam strUserName is not declared on line 15
I am not very well known with the vb scripting. Does anyone see what's wrong with it?
Thanks
Wiechert
Re: sms script (voipbuster)
Posted: Sun Jul 08, 2012 11:43 am
by AshaiRey
You get 5 errors in total with this script.
You have to use DIM. Better search Google on vbscript and the Dim statement because this will be knowledge that will be usefull for you in the future.
Re: sms script (voipbuster)
Posted: Sun Jul 08, 2012 6:29 pm
by mrqnapper
Now I ended up with this script:
Code: Select all
Sub Main()
Dim strUserName As String = "voipuserid"
Dim strPassword As String = "password"
Dim strPhoneNumber As String = "+31652343898"
Dim strFrom As String = "homeseer melding"
Dim strMessage As String = "ALARM"
Dim Response As String = hs.urlaction("https://www.voipbuster.com/myaccount/sendsms.php?username=" & strUserName _ & "&password=" & strPassword & "&from=" & strFrom & "&to=" & strPhoneNumber & "&text=" & strMessage, "GET", "", "")
End If
End Sub
Now I have compile error: Script compile error: Id wordt verwacht.on line 23
Still missing something her? So what do I want to achieve? I just want to send an simple sms message when this script is activated. Just the word Alarm will do.
Re: sms script (voipbuster)
Posted: Sun Jul 08, 2012 6:36 pm
by Digit
1st thing to do is get rid of the End If, because there is no matching If. This will never compile.
Re: sms script (voipbuster)
Posted: Sun Jul 08, 2012 7:47 pm
by mhn
I use Gammu for this.
I have a little CMD, which I call from HomeSeer.
cd c:\SMS\Gammu-1.29.0-Windows\bin\
echo "Der er bevægelse i huset, mens alarmen er aktiveret" |gammu --sendsms TEXT 11111111 >>c:\SMS\sms.log
(My phone number changed to 11111111, I don't want to be called by half of India.

)
Might be an easier way?
Regards
Morten
Re: sms script (voipbuster)
Posted: Sun Jul 08, 2012 9:36 pm
by mrqnapper
Digit wrote:1st thing to do is get rid of the End If, because there is no matching If. This will never compile.
Did not make much difference. Still the same error.
@Morten, Thanks, could also be an possibility but want to try the script first.
Anyone using a script like this that works? Thanks.
Re: sms script (voipbuster)
Posted: Sun Jul 08, 2012 9:46 pm
by Digit
Then find the script that does have a line 23

Re: sms script (voipbuster)
Posted: Sun Jul 08, 2012 10:13 pm
by mrqnapper
Yeah good idea

(need only 10 more lines than..
Re: sms script (voipbuster)
Posted: Sun Jul 08, 2012 10:37 pm
by Digit
And what is the _ doing there in the "Dim Response =" line?
Result of some editing after copy/paste to forum or?
Re: sms script (voipbuster)
Posted: Sun Jul 08, 2012 11:18 pm
by mrqnapper
It was there after some copy and paste. I already deleted it, and got in return a completely new compile error. "isn't that nice"
Than it returned:
Code: Select all
Scripting runtime error: System.Reflection.TargetParameterCountException: Het aantal parameters komt niet overeen. bij System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) bij System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) bij System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) bij Scheduler.VsaScriptHost.Invoke(String ModuleName, String MethodName, Object[] Arguments)
8-7-2012 23:00:28 BT Debug
??
So after some more googling, I re-included "parm as object" in the sub main (). And lucky me now it is working as intended
So for others looking for a SMS Script with voipbuster this is how it is:
Code: Select all
Sub Main(parm as object)
Dim strUserName As String = "voipuserid"
Dim strPassword As String = "password"
Dim strPhoneNumber As String = "+31652343898"
Dim strFrom As String = "homeseer melding"
Dim strMessage As String = "ALARM"
Dim Response As String = hs.urlaction("https://www.voipbuster.com/myaccount/sendsms.php?username=" & strUserName & "&password=" & strPassword & "&from=" & strFrom & "&to=" & strPhoneNumber & "&text=" & strMessage, "GET", "", "")
End Sub
Thanks for the support.
Re: sms script (voipbuster)
Posted: Mon Jul 09, 2012 9:51 am
by AshaiRey
In fact you are trying to run a script with no parameters and no changing data.
Actually it's just kicking off an URL.
Since you use all fixed data you can scrap all the initializing stuff too.
Code: Select all
Sub Main(parm as object)
Dim Response As String = hs.urlaction("https://www.voipbuster.com/myaccount/sendsms.php?username=voiduserid&password=password&from=homeseer%20melding&to=+31652343898&text=ALARM", "GET", "", "")
End Sub
You can do this probaly also without an external script.
Just past this in the event as a (script) action
hs.urlaction("
https://www.voipbuster.com/myaccount/se ... text=ALARM", "GET", "", "")
Anyway, nice that you figured this one out on you own.
Re: sms script (voipbuster)
Posted: Mon Jul 09, 2012 11:07 am
by mrqnapper
Bram thanks, interesting to learn how this works (especially when one is not a programmer by hart

.
Wiechert.
Re: sms script (voipbuster)
Posted: Mon Jul 14, 2014 1:21 pm
by mrqnapper
Hi,
If possible I like to extend the SMS script I have in use (or an event action) so it includes also an image from a camera.
For now the picture will be taken when the doorbell is pressed using the "Webcam script"
http://www.domoticaworld.com/scripts/webcams/ and saved in a directory.
So how to get the latest image from the saved files, attached to an sms message? Any advise on this? Or would there be an better way receiving alerts like this on your mobile?
Wiechert.
Re: sms script (voipbuster)
Posted: Mon Jul 14, 2014 2:47 pm
by AshaiRey
According me it is not possible to add a image to a sms message. The sms protocol doesn't allows this.