If you are using XTension from http://machomeautomation.com then you are right on track with having your house so automated. The range of what can be done is so amazing. Trying to get information out well there are many options you could use Prowl, Pushover, eMail, Messages, or Twitter.
I will be talking about Twitter here. First you need a piece of software to be able to tweet from apple script it can be found here Twitter Scripter
There are example found here
But to get the most use lets add a Handler to the attachments file in XTension the Long Version
--twitter on sendTweet(theMessage) tell application "Twitter Scripter" set availableAccounts to available accounts -- Test to check we've got at least one account if ((count of availableAccounts) is 0) then tell application "Finder" activate display dialog "Please set up at least one Twitter account in your System Preferences, and allow it to be accessed by \"Twitter Scripter\"" buttons {"OK"} default button "OK" with icon 2 with title "No Available Twitter Accounts" end tell return end if set Account to item 2 of availableAccounts --on the mac you have to set this to the account you will be tweeting from set theTime to current date -- this is necessary direct message theMessage & " " & theTime to username "the destination of the DM" using account Account --must be followed end tell end sendTweet
All that is necessary is the one below I recommend it because it will take up less of your Attachments file.
--twitter on sendTweet(theMessage) tell application "Twitter Scripter" set availableAccounts to available accounts set Account to item 2 of availableAccounts --change as necessary set theTime to current date direct message theMessage &" " & theTime to username "the destination of the DM" using account Account end tell end sendTweet
The longer version is if you do not have any accounts set up then you will get a prompt to setup one.
Once these are entered then you can use this command to send a tweet:
sendTweet("ALERT!, GARAGE left open!") sendTweet("Hi!")
the result will be something like this:
ALERT! : GARAGE left open! Wednesday, September 23, 2015 at 12:11:35 AM Hi! Wednesday, September 23, 2015 at 12:11:53 AM
The current date is necessary because Twitter Scripter will not send a message that is the same. By adding the date we change the message even if it has been sent multiple times.
Now you got Twitter working!
Recent Comments