AppleScript Forward Messages Attachments
Hello,
I'm trying to make it so that any iMessages including picture/video attachments I receive get forwarded to my e-mail address. I created a script that runs on the "message received" event from the iMessages preferences. It worked fine for just text, but cant seem to get the video/picture out of the message.
using terms from application "Messages"
on message receivedtheMessagefromtheBuddyfortheChat
get attachmenttheFile
tell application "Mail"
set theNewMessage to makenewoutgoing messagewith properties {subject:"sometext", content:theMessage, visible:true}
tell theNewMessage
makenewto recipientat end of to recipientswith properties {address:"myemail@gmail.com"}
makenewattachmentwith properties {file name:theFile}
send
end tell
end tell
end message received
end using terms from
As I expected I get an error that "theFile" is undefined or whatever, meaning that get attachment had no effect. For now lets assume every message received will always contain a picture and some text.
Any help would be greatly appreciated!
MacBook Air, OS X Mountain Lion (10.8.4)