Using Siri to control XTension
George Handley
ghandley at kc.rr.com
Thu Oct 1 16:46:43 EDT 2015
Wow Tom, it looks like a straight forward plan… particularly after I learn some of the terms you used.
For right now, however, I would like to confirm what I believe you originally said could be done which is pretty close to what you have in your post.
I have over 200 i/o points, and other than scheduled events, which are also macros, we run everything around here using Palm Pads. I built macro global scripts to act on the press of any certain Palm Pad button.
From my understanding of your previous explanations, I can dream up as many specific and consistent short phrases to verbally say to Siri in iMessage. I’ll call the contact name in iMessage “Arthur.”
While I vaguely presently understand your instructions below, the point is, XTension will receive the exact text, and can be evaluated, acknowledged, and acted upon. So I send a text message to Arthur saying something like: “Arthur, please turn on the living room."
When ever XTension gets an Arthur iMessage, I will have built a master global script with every possible “Arthur, please do something” phrase to be evaluated. If there is a match, it will execute the existing global scripts I have in the On/Off scripts for the Palm Pads.
Have I accurately re-described what you are doing?
Thanks,
George
> On Oct 1, 2015, at 3:11 PM, Thomas Arman <tarman at me.com> wrote:
>
> I have been having fun today :-)
>
> Since my XTension runs on a Mini, I made a Contact entry called “Mini” with just the email address set to the AppleID on which it receives its iMessages.
>
> So now I can tell Siri to “Send a message to Mini.”
>
> Using the attached script as the “AppleScript handler” for Messages app on “Mini”, I can now send messages with the following syntax:
>
>
> [Tell] <Extension> [to] turn [on|off] <unit name>
>
> Where:
> <Extension> can be: Extension, extension, TellXT, tellXT, Tell XT, or tell XT. (Siri can’t spell XTension, :-)
>
> [Tell] can be any text other than the values of <Extension> or it can be null.
>
> [to] is optional
>
> turn [on|off] can be: turn on, turnon, turn off, or turnoff.
>
> White space is ignored every where EXCEPT must be one space between: to & turn, turn & [on|off], if you use those forms.
> White space is PRESERVED inside of <unit name> string. Siri is pretty good a just putting one space between words.
>
> James can confirm, but the <unit name>’s appear to be case insensitive (which is good for Siri.)
> You biggest problem will likely be having unit names Siri can understand. I made some units with “nice names” the just turn on/off the units that Siri can’t understand.
>
> Some examples I used to test:
>
> "Siri tell Mini to tell extension to turn on great room lights”
>
> “Siri, send a message to Mini” …
> … OK, what do you want to say to Mini?
> “Extension turn off loft light”
>
> OK, for security, I only act on requests FROM chat buddies whose “handle” matches what I expect.
> Near the top of the AppleScript there is this chunk of code:
>
> property handleList : "tarman at me.com <mailto:tarman at me.com>" --<<<<<<<<< CHANGE THIS
>
> using terms from application "Messages"
>
> -- handler to respond to all incoming messages.
> on message received theMessage from theBuddy for theChat
> set savedDelim to get AppleScript's text item delimiters
>
> set theID to id of theBuddy
> --display dialog "-" & theID & "-ID"
> set AppleScript's text item delimiters to {":"}
> set theHandle to text item 2 of theID
> set AppleScript's text item delimiters to savedDelim
> --display dialog "-" & theHandle & "-Handle" --<<<<<< USE THIS TO ID SENDER
> NOTE: I have removed the “--“ from this “display dialog” for you. Put back after finding handle"
>
> handleList needs to be a blank separated list of “handles”. In my case I just use one, tarman at me.com <mailto:tarman at me.com>.
>
> After you enable the script as the “AppleScript handler” in Messages, you can determine the “handle” your iPhone, Mac, etc., uses by sending it a iMessage.
>
> When you send a message to the machine, a dialog should appear that looks like this:
> <PastedGraphic-1.tiff>
>
> Once you have determined it, put your handle in the “handleList” property, put back the “--“, compile and save script.
>
> Messages app can be a bit snooty about enabling the handler. If you have problems with it, try
> changing the handler to “None”, send it a couple of messages, then re-select the script.
> That has worked for me.
>
> Here is the applescript file, I will sent a text copy if you need it.
> <Extension Control.applescript>
>
> Contact me on or off line with questions or comments.
>
> Tom
>
> _______________________________________________
> XTensionList mailing list
> XTensionList at machomeautomation.com
> http://mail.machomeautomation.com/mailman/listinfo/xtensionlist
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.machomeautomation.com/pipermail/xtensionlist/attachments/20151001/4c29525f/attachment.html>
More information about the XTensionList
mailing list