Skip to content

Instantly share code, notes, and snippets.

@neilvallon
Created May 13, 2014 19:44
Show Gist options
  • Save neilvallon/e27bc2612d258567afde to your computer and use it in GitHub Desktop.
Save neilvallon/e27bc2612d258567afde to your computer and use it in GitHub Desktop.
Applescript mail action to translate texts to piglatin and send them back - Jul 24 2009
using terms from application "Mail"
on perform mail action with messages theMessages
tell application "Mail"
repeat with theMessage in theMessages
set theText to content of theMessage
set theSender to sender of theMessage
set TempTID to AppleScript's text item delimiters
set AppleScript's text item delimiters to space
set theText to text items of theText
set AppleScript's text item delimiters to "%20"
set theText to theText as string
set AppleScript's text item delimiters to TempTID
tell application "WebKit.app"
open location "http://piglatin.neilvallon.com/piglatin.php?msg=" & theText & "&sender=" & theSender
end tell
end repeat
end tell
end perform mail action with messages
end using terms from
tell application "Mail"
set myMessages to selection
tell me to perform mail action with messages myMessages
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment