sms script (voipbuster)

Forum over Homeseer scripts (DUTCH forum)

Moderators: TANE, Ruud

Post Reply
mrqnapper
Member
Member
Posts: 234
Joined: Sat Jun 25, 2011 1:08 pm

sms script (voipbuster)

Post 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
AshaiRey
Senior Member
Senior Member
Posts: 1310
Joined: Mon Feb 02, 2009 5:27 pm
Location: Netherlands
Contact:

Re: sms script (voipbuster)

Post 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.
Bram
mrqnapper
Member
Member
Posts: 234
Joined: Sat Jun 25, 2011 1:08 pm

Re: sms script (voipbuster)

Post 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.
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: sms script (voipbuster)

Post by Digit »

1st thing to do is get rid of the End If, because there is no matching If. This will never compile.
mhn
Member
Member
Posts: 399
Joined: Tue Jul 21, 2009 9:27 pm
Location: Denmark

Re: sms script (voipbuster)

Post 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
mrqnapper
Member
Member
Posts: 234
Joined: Sat Jun 25, 2011 1:08 pm

Re: sms script (voipbuster)

Post 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.
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: sms script (voipbuster)

Post by Digit »

Then find the script that does have a line 23 :lol:
mrqnapper
Member
Member
Posts: 234
Joined: Sat Jun 25, 2011 1:08 pm

Re: sms script (voipbuster)

Post by mrqnapper »

Yeah good idea :) (need only 10 more lines than..
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

Re: sms script (voipbuster)

Post by Digit »

And what is the _ doing there in the "Dim Response =" line?
Result of some editing after copy/paste to forum or?
mrqnapper
Member
Member
Posts: 234
Joined: Sat Jun 25, 2011 1:08 pm

Re: sms script (voipbuster)

Post 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.
AshaiRey
Senior Member
Senior Member
Posts: 1310
Joined: Mon Feb 02, 2009 5:27 pm
Location: Netherlands
Contact:

Re: sms script (voipbuster)

Post 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.
Bram
mrqnapper
Member
Member
Posts: 234
Joined: Sat Jun 25, 2011 1:08 pm

Re: sms script (voipbuster)

Post by mrqnapper »

Bram thanks, interesting to learn how this works (especially when one is not a programmer by hart :).

Wiechert.
mrqnapper
Member
Member
Posts: 234
Joined: Sat Jun 25, 2011 1:08 pm

Re: sms script (voipbuster)

Post 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.
AshaiRey
Senior Member
Senior Member
Posts: 1310
Joined: Mon Feb 02, 2009 5:27 pm
Location: Netherlands
Contact:

Re: sms script (voipbuster)

Post by AshaiRey »

According me it is not possible to add a image to a sms message. The sms protocol doesn't allows this.
Bram
Post Reply

Return to “Homeseer Scripts Forum”