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!
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
When you are setting attachments you need to have your file enclosed in quotes set ttheAttachment1 to POSIX file "/Users/Andrew/Desktop/EnergyUse.pdf" This is an example of sending a PDF not just a picture. The POSIX was a true help thanks dhval