Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Pegoto

macrumors newbie
Original poster
Jun 7, 2011
21
86
Hi, i am trying to send an image via messages using applescript and I get the error "Messages got an error: Can't send specified file." Everything else works fine, it is just send the image. This is what I have in my AppleScript:

Code:
do shell script "curl -f 'http://<IP_OF_CAMERA/snapshot.cgi?user=<USERNAME>&pwd=<PASSWORD>&resolution=32' -o ~/Desktop/test.png"
tell application "Messages"
	send "Garage door has been opened." to buddy "<iMESSAGE_RECIPIENT.com>"
end tell
set theAttachment1 to POSIX file "Desktop/test.png"
tell application "Messages"
	send theAttachment1 to buddy "<iMESSAGE_RECIPIENT.com>"
end tell

I am an AppleScript noob and I have been able to piece this together from various posts on here and elsewhere.
 
Edit: Had to revert this change I made.
 
Last edited:
Got it all working. Leaving it up for someone else that might need it or when I forgot how I did it and have to recreate it because my backup was corrupt ;)

Code:
do shell script "curl -f 'http://<IP_OF_CAMERA/snapshot.cgi?user=<USERNAME>&pwd=<PASSWORD>&resolution=32' -o ~/Desktop/test.png"
tell application "Messages"
	send "Garage door has been opened." to buddy "<iMESSAGE_RECIPIENT.com>"
end tell
set theAttachment1 to POSIX file "Desktop/test.png"
tell application "Messages"
	send file theAttachment1 to buddy "<iMESSAGE_RECIPIENT.com>"
end tell
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.