iMessages - Cant send to self

Posted on
Thu Nov 01, 2012 4:13 am
wiery offline
Posts: 288
Joined: Jun 02, 2008
Location: Ireland

iMessages - Cant send to self

I setup a low temperature trigger and thought it would be handy to use apple script to send a message to my phone that it had triggered, but messages throws up an errors saying you cannot send messages to yourself.

Any ideas ?

Posted on
Thu Nov 01, 2012 6:36 am
matt (support) offline
Site Admin
User avatar
Posts: 21417
Joined: Jan 27, 2003
Location: Texas

Re: iMessages - Cant send to self

What is the exact verbiage of the message? If anything is in the Event Log, then copy/paste it for us to take a look.

Image

Posted on
Thu Nov 01, 2012 7:36 am
wiery offline
Posts: 288
Joined: Jun 02, 2008
Location: Ireland

Re: iMessages - Cant send to self

Thanks Matt, i'm getting the below in log
Error script error: around characters 132 to 182
Error script error: Messages got an error: Can't send a message to yourself. (1)

And using the below codeset message_text to "The low temperature warning in the kitchen has triggered, boosting heat for 1 hour"

tell application "Messages"
send message_text to buddy "XXX"
end tell


The problem seems to be that i need to address the message to a specific email address on my contacts for myself as there are multiple email addresses. Am i better just creating a new contact with the email address I want or can i specify which email of the contact to send it to.

Posted on
Thu Nov 01, 2012 9:52 am
wiery offline
Posts: 288
Joined: Jun 02, 2008
Location: Ireland

Re: iMessages - Cant send to self

I got it sorted Matt, you need to have a conversation started in Messages with yourself and it works then. This opens up lots of possibilities now.


set message_text to "The low temperature warning in the kitchen has triggered, boosting heat for 1 hour"

tell application "Messages"
set myid to get id of first service
set theBuddy to buddy "+123456789" of service id myid
send message_text to theBuddy
end tell

Posted on
Sat Dec 21, 2013 12:55 pm
jenwill1 offline
Posts: 185
Joined: Mar 22, 2009
Location: Boerne, Texas

Re: iMessages - Cant send to self

A couple of tweaks to get this to work for me.

set targetMessage to "The low temperature warning in the kitchen has triggered, boosting heat for 1 hour"

tell application "Messages"
set targetService to 1st service whose service type = iMessage
set targetBuddy to buddy "+10123456789" of targetService
send targetMessage to targetBuddy
end tell

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 8 guests