Applescript: forwarding subject of mail as mobile short message (SMS) via Skype -
in apple mail (mail.app), defined rule calls applescript when receiving email. script should send subject of mail sms message via skype (it should send name of sender). i've got script working sends hardcoded text sms, don't know how pass subject , senders name mail sms. here's script:
# code adapted from: # http://photolifetoys.blogspot.de/2011/12/applescript-control-over-skype-call.html # variables set calltoanumber "+01234567890" set smsmessagebody " has sent mail." set senderofmail "thesenderoftheemail" set mailsubject "thesubjectofthemail" # body set smstext "senderofmail" & smsmessagebody unicode text tell application "skype" set message send command "create sms outgoing " & calltoanumber script name "sms" set smsid item 2 of every word of message send command "set sms " & smsid & " body " & smstext script name "sms" set result send command "alter sms " & smsid & " send" script name "sms" #display dialog "sms send! text: " & smstext end tell
now i've got answer. here's code:
using terms application "mail" on perform mail action messages these_messages rule this_rule tell application "mail" set message_count count of these_messages repeat 1 message_count set this_message item of these_messages -- sender of message set this_sender sender of this_message -- subject of message try set this_subject (subject of this_message) unicode text if this_subject "" error on error set this_subject "no subject" end try -- content of message try set this_content (every character of content of this_message) unicode text if this_content in {"", "?"} error on error error_message set this_content "no content" end try end repeat end tell set calltoanumber "+0123456789" # body set smstext this_subject unicode text tell application "skype" set message send command "create sms outgoing " & calltoanumber script name "sms" set smsid item 2 of every word of message send command "set sms " & smsid & " body " & smstext script name "sms" set result send command "alter sms " & smsid & " send" script name "sms" #display dialog "sms send! text: " & smstext end tell end perform mail action messages end using terms
Comments
Post a Comment