Skip to content

Instantly share code, notes, and snippets.

@pdxmph
Created January 11, 2015 07:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pdxmph/68d950605a73eea0c59a to your computer and use it in GitHub Desktop.
Save pdxmph/68d950605a73eea0c59a to your computer and use it in GitHub Desktop.
Send a message to Trello
on log_err(message)
display notification message
log message
end log_err
on run
try
tell application "Mail"
set theAddress to "my_trello_board_address@trelllo.com"
set messageURL to ""
set messageContent to ""
set theSelection to selection
set theMessage to item 1 of theSelection
set messageURL to ("message://%3c" & theMessage's message id & "%3e")
set messageText to (content of theMessage)
set messageSubject to subject of theMessage
set myMessage to make new outgoing message with properties {content:messageURL & return & return & messageText, subject:messageSubject, visible:true}
tell myMessage to make new to recipient with properties {address:theAddress}
-- I'd like to delete the message, but it seems to cause a 10s freeze in the app
-- delete theMessage
end tell
on error errmsg
my log_err("Could not send message: " & errmsg)
end try
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment