Skip to content

Instantly share code, notes, and snippets.

@matthewpalmer
Created December 7, 2013 01:49
Show Gist options
  • Save matthewpalmer/7836328 to your computer and use it in GitHub Desktop.
Save matthewpalmer/7836328 to your computer and use it in GitHub Desktop.
Automatically post to tumblr from iA Writer
# The file we are using is the frontmost one in iA Writer
# Returns the location of the file
set the_file to get file of front document of application "iA Writer"
# Get the contents of the file
set the_initial_text to (do shell script "cat " & quoted form of (POSIX path of the_file))
# Set the title to the filename
set the_title to get name of front document of application "iA Writer"
# Append '!m' to the title so Tumblr knows it's Markdown
set the_markdown_title to the_title & " !m "
tell application "Mail"
# Create a new email
set theNewMessage to make new outgoing message with properties {subject:the_markdown_title, content:the_initial_text, visible:true}
tell theNewMessage
# Send the email to your private Tumblr posting email address
set tumblr_email to "YOUREMAILPUBLISHINGCODE@tumblr.com"
make new to recipient at end of to recipients with properties {address:tumblr_email}
# Make the send window the active window
activate
# Send the email (uncomment for the email to send without the preview screen)
# send
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment