Hi Paco and Mric !
Sorry to answer in late but I was busy (but not enough to read every day the news on the forum
)
Paco wrote:Hey Lalit, could you give more details about your installation ? Have you written an attachment script that would work like Ovolab Phlink one to use only one line instruction (MakeEmergencyCallToNumber) to call phones ?
You don't need an attachment script but only an external script stored in Library:Application Support:Perceptive Automation:Indigo 2:Scripts
You don't need to load this script into memory because we don't use often the script like the weather script or security script !
First of all you have to create 5 variables in Indigo to use with SMSMac :
- SmsRestants : SMS left in your account
- TypeSms : flash (for non-important event) or texto (which is stored in the memory of the cellular)
- Emetteur : sender
- Destinataire : receiver
- Message : content of the SMS
Then you have to create a script that I've called SMS
Then copy/paste this :
tell application "IndigoServer"
if value of variable "TypeSms" is "texto" then set TypeSms to false
if value of variable "TypeSms" is "flash" then set TypeSms to true
set emetteur to value of variable "Emetteur"
if value of variable "Destinataire" is "monsieur" then set destinataire to "+336XXXXXXXX"
if value of variable "Destinataire" is "madame" then set destinataire to "+336XXXXXXXX"
set contenu to value of variable "Message"
end tell
tell application "SMS Mac Scripting"
set account to "xxxxxxxx"
set pin to "xxxx"
set sms to make new outgoing sms
tell sms
set flash to TypeSms
set delivery report to true
set sender to {emetteur}
set recipients to {destinataire}
set message to contenu
my envoiSms()
end tell
end tell
on envoiSms()
tell application "SMS Mac Scripting"
send outgoing sms 1
set textoRestants to balance
end tell
delay 1
tell application "IndigoServer"
set value of variable "SmsRestants" to textoRestants
set value of variable "TypeSms" to ""
set value of variable "Emetteur" to ""
set value of variable "Destinataire" to ""
set value of variable "Message" to ""
end tell
end envoiSms
Let me explain why I have a few receivers : each alarm remote has a unique ID, so for example if my wife left the window open when she leaves home she will receive the SMS, not me ! Do you understand ?
Then, on each script you want a SMS notification, copy/paste this :
tell application "IndigoServer"
set value of variable "TypeSms" to "flash" -- or "texto" as you want
set value of variable "Emetteur" to "Indigo"
set value of variable "Destinataire" to "monsieur"
set value of variable "Message" to ":-( Blablabla" -- SMSMac support smileys !
execute script "/:Library:Application Support:Perceptive Automation:Indigo 2:Scripts:SMS.scpt"
end tell
If you want to use it in the Security attachment script and want to type only one line instruction :
using terms from application "IndigoServer"
on receive security event of evenement with code dispositifID
---blabla---
if evenement is sec_SensorNormal_min then detecteurVeille_min(dispositifID)
if evenement is sec_SensorNormal_max then detecteurVeille_max(dispositifID)
if evenement is sec_SensorAlert_min then detecteurAlerte_min(dispositifID)
if evenement is sec_SensorAlert_max then detecteurAlerte_max(dispositifID)
---blabla---
end receive security event
on detecteurAlerte_min(dispositifID)
if dispositifID = 110 then --
my sms("texto", "ALARME", "monsieur", ":-( L'alarme a été déclenchée par la porte d'entrée ! Blablabla...")
end if
if dispositifID = 82 then --
my sms("texto", "ALARME", "monsieur", ":-( L'alarme a été déclenchée par la fenêtre ! Blablabla...")
end if
end detecteurAlerte_min
-- at the end of the script
on sms(smsType, emetteur, destinataire, contenu)
set value of variable "TypeSms" to smsType
set value of variable "Emetteur" to emetteur
set value of variable "Destinataire" to destinataire
set value of variable "Message" to contenu
execute script "/:Library:Application Support:Perceptive Automation:Indigo 2:Scripts:SMS.scpt"
end sms
end using terms from
Hope it helps !
Lalit