Hello,
I’m brand new to AppleScript and OSX in general. I’m trying to make a script that automatically forwards my iMessages to my email. I made it so that my script runs when a new Message is received from the Messages preferences. It works fine for plain text messages, but not with any media, specifically pictures and videos.
using terms from application "Messages"
on received file transfer invitation theFileTransfer
accept transfer of theFileTransfer
tell application "Mail"
set theNewMessage to make new outgoing message with properties {subject:"Photo Received", content:"content", visible:true}
tell theNewMessage
make new to recipient at end of to recipients with properties {address:"myemail@gmail.com"}
send
end tell
end tell
end received file transfer invitation
on message received theMessage from theBuddy for theChat
tell application "Mail"
set theNewMessage to make new outgoing message with properties {subject:"Text Message", content:theMessage, visible:true}
tell theNewMessage
make new to recipient at end of to recipients with properties {address:"myemail@gmail.com"}
send
end tell
end tell
end message received
end using terms from
I’ve also tried using “completed file transfer” event but no luck. I think that pictures might not be considered a file transfer but rather an attachment of sorts.
Here is a class that is available from the Messages dictionary:
attachment‚n [inh. rich text] : Represents an inline text attachment. This class is used mainly for make commands.
elements
contained by rich text, characters, paragraphs, words, attribute runs.
properties
file (file, r/o) : The path to the file for the attachment syn file name
I have no idea how to use this or where to go from here any help would be greatly appreciated!
Model: MacBook Air
Browser: Safari 536.30.1
Operating System: Mac OS X (10.8)