A little HELP for security SCRIPTING

Forum with questions and discussions about security or security devices like Marmitek, Elro Elk (other then Visonic)
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

A little HELP for security SCRIPTING

Post by Digit »

(i meant the HS related section of this forum [:)])
drmacchi
Advanced Member
Advanced Member
Posts: 827
Joined: Wed Aug 08, 2007 5:48 pm
Location: Italy

A little HELP for security SCRIPTING

Post by drmacchi »

OHI OHI, it doesn't work. I don't have errors in LOG , but i don't receive sms (with others functions i receive sms from HS)
LOG :
Running script statement immediately: &Sub Main() dim cDIA cDIA = "" For Each d In hs.Plugin("BLSecurity").GetSecurityDevicesInAlert() if cDIA = "" then cDIA = d else cDIA = cDIA & "," & d end if Next rs = hs.urlaction("https://myaccount.voipbuster.com/clx/se ... ****&text=" this is my text")End Sub
User avatar
Noel
Senior Member
Senior Member
Posts: 1887
Joined: Tue Feb 12, 2008 12:13 am
Location: Netherlands
Contact:

A little HELP for security SCRIPTING

Post by Noel »

I do not have BLSecurity installed (and I suck in vb coding), but give this a try.

Code: Select all

&Sub Main() 
dim cDIA 
cDIA = "" 
For Each d In hs.Plugin("BLSecurity").GetSecurityDevicesInAlert() 
if cDIA = "" then cDIA = d 
else 
cDIA = cDIA & "," & d 
end if 
Next 

hs.launch("iexplore.exe", "https://myaccount.voipbuster.com/clx/sendsms.php?username=*******&password=***&from=*****&to=+39******&text="  & cDIA )

End Sub
<h6>Anyone interested in time travel meet me here last Thursday!!

Download todays latest spoken weather (in Dutch) here (MP3).</h6>
drmacchi
Advanced Member
Advanced Member
Posts: 827
Joined: Wed Aug 08, 2007 5:48 pm
Location: Italy

A little HELP for security SCRIPTING

Post by drmacchi »

Wifi, with your version i have errors , from LOG :
Error Running script, init error: Previsto 'Next'
User avatar
Noel
Senior Member
Senior Member
Posts: 1887
Joined: Tue Feb 12, 2008 12:13 am
Location: Netherlands
Contact:

A little HELP for security SCRIPTING

Post by Noel »

Try again with this one (note that I changed the:
if cDIA = "" then cDIA = d
to
if cDIA = "" then
cDIA = d

Also.. It looks to me that d also needs to be dim'ed
So I added dim d to it
Again. I suck in VB stuff..

Code: Select all

&Sub Main() 
dim cDIA 
dim d
cDIA = "" 
For Each d In hs.Plugin("BLSecurity").GetSecurityDevicesInAlert() 
if cDIA = "" then 
cDIA = d 
else 
cDIA = cDIA & "," & d 
end if 
Next 

hs.launch("iexplore.exe", "https://myaccount.voipbuster.com/clx/sendsms.php?username=*******&password=***&from=*****&to=+39******&text="  & cDIA )

End Sub
<h6>Anyone interested in time travel meet me here last Thursday!!

Download todays latest spoken weather (in Dutch) here (MP3).</h6>
drmacchi
Advanced Member
Advanced Member
Posts: 827
Joined: Wed Aug 08, 2007 5:48 pm
Location: Italy

A little HELP for security SCRIPTING

Post by drmacchi »

Worst:
Option Strict Offimports Schedulerimports SystemPublic Module scriptcode15#Region "Automatically generated code, do not modify"'Automatically generated code, do not modify'Event Sources Begin Public WithEvents hs As Scheduler.hsapplication Public WithEvents hsp As scheduler.hsp Public WithEvents hssystem As scheduler.phone0'Event Sources End'End of automatically generated code#End Region&Sub Main() dim cDIA dim dcDIA = "" For Each d In hs.Plugin("BLSecurity").GetSecurityDevicesInAlert() if cDIA = "" then cDIA = d else cDIA = cDIA & "," & d end if Next hs.launch("iexplore.exe",
drmacchi
Advanced Member
Advanced Member
Posts: 827
Joined: Wed Aug 08, 2007 5:48 pm
Location: Italy

A little HELP for security SCRIPTING

Post by drmacchi »

Just a question: in HS must i choose option "run script immediately" or do i have to create a scriptfile.vb and paste here you code? Because the error in last post is using a .vb file, the same code in option "run script immd" is : Error Running script, init error: Impossibile utilizzare parentesi per la chiamata di routine Sub
TRANSLATION FROM ITALIAN : YOU CAN NOT USE ( FOR CALLING ROUTINE SUB
User avatar
Noel
Senior Member
Senior Member
Posts: 1887
Joined: Tue Feb 12, 2008 12:13 am
Location: Netherlands
Contact:

A little HELP for security SCRIPTING

Post by Noel »

I love those error messages. They really help. NOT!

Sorry drmacchi. Non ho alcun indizio.



<h6>Anyone interested in time travel meet me here last Thursday!!

Download todays latest spoken weather (in Dutch) here (MP3).</h6>
Digit
Global Moderator
Global Moderator
Posts: 3388
Joined: Sat Mar 25, 2006 10:23 am
Location: Netherlands
Contact:

A little HELP for security SCRIPTING

Post by Digit »

Get rid of the &, it is incorrect. It doesn't belong there.

<b>&</b>Sub Main()
dim cDIA
dim d
cDIA = ""
etc.etc.

And you have to put it in a file also. This is not a one-liner.
User avatar
Noel
Senior Member
Senior Member
Posts: 1887
Joined: Tue Feb 12, 2008 12:13 am
Location: Netherlands
Contact:

A little HELP for security SCRIPTING

Post by Noel »

drmacchi,

I've installed BLSecurity, and it's seeing the sensors, but what ever I try I can not get it to trigger the "Event to execute for ARMED alert"
I made a test event, to turn on a light with as trigger: "BLSecurity Trigger", and as Edit Plug-In Specific Trigger: "Security Alert Trigger"
The action is to turn on a light.

The event never runs?
When I select as Edit Plug-In Specific Trigger: "Security Mode Changed to ARMED", the event does run when I arm BLSecurity

Are you able to run events (like light on) when there is a Security Alert Trigger?


<h6>Anyone interested in time travel meet me here last Thursday!!

Download todays latest spoken weather (in Dutch) here (MP3).</h6>
drmacchi
Advanced Member
Advanced Member
Posts: 827
Joined: Wed Aug 08, 2007 5:48 pm
Location: Italy

A little HELP for security SCRIPTING

Post by drmacchi »

Wifi, i DON'T USE in OPTIONS of plugin "Event to execute for ARMED alert", my working way is : create a SECURITY EVENT , where sensors involved are some TM13.
i.e: alarm alert : trigger = BLADE SEC. TRIGGER , then Edit Plug-In Specific Trigger: "Security Alert Trigger", then action = turn ON lights , send emails. YES THEY WORK ! i have 3 actions : lights on , send email and i'd like to receive SMS , the one that doesn't work........
I'm able to arm/disarm BLADE SECURITY, with one touch based on SC9000 STATUS CHANGE, this trigger will do this action : BLSecurity Action: Set Security Mode to ARMED/DISARMED. About my request : i know i could immediately recieve an SMS , simply using a TEXT. This already works. I'd like that the system gave me informations about which sensor generated the alarm, that because of script we're testing.Thanks guys:)
drmacchi
Advanced Member
Advanced Member
Posts: 827
Joined: Wed Aug 08, 2007 5:48 pm
Location: Italy

A little HELP for security SCRIPTING

Post by drmacchi »

Hi all, this is the follow up of my problem: i sent a request to Blade's support and Blade (Bob) sent me 2 different scripts. These scripts must be saved as .vb files and used in HS, events, actions , run script. When i run them i don't have any error code, but both don't make I.explorer start. , but Bob says on my pc this works ! So a need a third man taht tries them, it's not important to have a Voip SMS account i simply need to know if Explorer is startd by the script. Hoping someone has 5 minutes to waste :)...thanks guys!

SCRIPT VERSION A

Sub Main(ByVal parms As Object)

For Each d As String In hs.Plugin("BLSecurity").GetSecurityDevicesInAlert()

Dim devCode As String = hs.GetDeviceCode(d.Trim)

Dim sensorInfo As String = ""
sensorInfo = sensorInfo & hs.DeviceLastChange(devCode) & " - "
sensorInfo = sensorInfo & devCode
sensorInfo = sensorInfo & " (" & d.Trim & ")"

Dim theUrl As String = "https://myaccount.voipbuster.com/clx/se ... yyyy&text=" & sensorInfo
hs.launch("iexplore.exe", theUrl, "")
theUrl = Nothing

sensorInfo = Nothing
devCode = Nothing
Next

End Sub

SCRIPT VERSION B

Sub Main(ByVal parms As Object)

For Each d As String In hs.Plugin("BLSecurity").GetSecurityDevicesInAlert()

Dim devCode As String = hs.GetDeviceCode(d.Trim)

Dim sensorInfo As String = ""
sensorInfo = sensorInfo & hs.DeviceLastChange(devCode) & " - "
sensorInfo = sensorInfo & devCode
sensorInfo = sensorInfo & " (" & d.Trim & ")"

Dim theUrl As String = "https://myaccount.voipbuster.com/clx/se ... yyyy&text=" & sensorInfo
System.Diagnostics.Process.Start("IExplore.exe", theUrl)
theUrl = Nothing

sensorInfo = Nothing
devCode = Nothing
Next

End Sub
User avatar
b_weijenberg
Forum Moderator
Forum Moderator
Posts: 1744
Joined: Sun May 14, 2006 4:32 pm
Location: Netherlands

A little HELP for security SCRIPTING

Post by b_weijenberg »

In't have BLsecurity so cannot run your script.

Replace this:
Dim theUrl As String = "https://myaccount.voipbuster.com/clx/se ... yyyy&text=" & sensorInfo
hs.launch("iexplore.exe", theUrl, "")

by:
hs.urlaction("https://myaccount.voipbuster.com/clx/se ... yyyy&text=" & sensorInfo, "GET", "", "")
drmacchi
Advanced Member
Advanced Member
Posts: 827
Joined: Wed Aug 08, 2007 5:48 pm
Location: Italy

A little HELP for security SCRIPTING

Post by drmacchi »

Bert, nothing better. No errors running script but Explorer is not launched. I add another action (send email) to check really if trigger start actions and so it is.
from LOG:

05/12/2008 9.21.03 Database Item Saving Event ALLARME SMS INTRUSIONE BLADE SECURITY
05/12/2008 9.21.12 Info Event Trigger "ALLARME SMS INTRUSIONE BLADE SECURITY"
05/12/2008 9.21.12 Info Running script in background: allarme-blade-sms.vb
05/12/2008 9.21.13 Info Email successfully sent to xxxx@xxxwind.it
User avatar
Noel
Senior Member
Senior Member
Posts: 1887
Joined: Tue Feb 12, 2008 12:13 am
Location: Netherlands
Contact:

A little HELP for security SCRIPTING

Post by Noel »

drmacchi
The new string from Bert is so that Explorer does not get launched.
So. It's correct that Explorer does not get launched :-)


Small tip: If you like spam it's okay to post real email addresses on the web (like a forum), but if you do NOT like spam NEVER EVER post your email address on a website / forum!
Post Reply

Return to “Security & Alarmpanels Forum”