Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Oct 20, 2012, 01:53 AM   #1
MACza
macrumors member
 
Join Date: May 2011
Send image from Messages.app to iMessage

Hi Guys!

I hope somebody can assist me with an applescript I am attempting.

The aim: to send myself an image from my MAC to my iphone via Messages/iMessage.

OK, I can send text messages successfully with the following:

Code:
tell application "Messages"
	set myid to get id of first service
	set theBuddy to buddy "+123456789" of service id myid
	send "Test message" to theBuddy
end tell
How do I now add an image to the message?

I was trying something like the following:

Code:
tell application "Messages"
	set myid to get id of first service
	set theBuddy to buddy "+123456789" of service id myid
	set targetFileName to "Macintosh HD:Users:user:Pictures:picture.PNG:"
	make new attachment with properties {file:targetFileName}
	send "Test message" to theBuddy
end tell
WIth the above, I get the following error back:
"Messages got an error: Can’t make or move that element into that container."

I am not sure what this means or what the solution is

It also seems like I should tell Messages to send the attachment. Not sure if it should be part of the "send" command, or if I should send the image in it's own "send" call.

Any help will be greatly appreciated!

Thanks!
MACza is offline   0 Reply With Quote
Old Oct 21, 2012, 11:23 AM   #2
MACza
Thread Starter
macrumors member
 
Join Date: May 2011
Ah, never mind, I finally got it sorted out! :-)
MACza is offline   0 Reply With Quote
Old Nov 8, 2012, 09:10 AM   #3
keithjmason
macrumors newbie
 
Join Date: Nov 2012
Hi,

Would you mind sharing how you sorted this out ? Trying to do the same thing.

Thanks!

Keith
keithjmason is offline   0 Reply With Quote
Old Jan 20, 2013, 03:20 PM   #4
gentertain
macrumors newbie
 
Join Date: Jan 2013
Hi,
how did you fix the error? i am interested in doing the same thing.

Thanks
gentertain is offline   0 Reply With Quote
Old Jan 30, 2013, 12:14 PM   #5
dhval
macrumors newbie
 
Join Date: Jan 2013
set theAttachment1 to POSIX file /Users/lil/pic.png
tell application "Messages"
send theAttachment1 to buddy "+1 (xxx) x7 " of service "E:yourappleid@gmail.com"
end tell
dhval is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > Mac Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 08:34 AM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC