John’s posterous

I always did like sending email 
« Back to blog

Safari Selection to Posterous

tell application "Safari"
            
            set theURL to URL of front document
            set theTitle to do JavaScript "document.title" in front document
            set selecTxt to (do JavaScript "(getSelection())" in document 1)
            set selecTxt to "<div style=\"font-size:18px;font-family: Georgia,serif;\"><div style=\"float:left;font-size:64px\">“</div>" & selecTxt & "</div>"
yle="color: #000000;">            set theBody to selecTxt & return & return & "Quoted from:" & return & theURL
end tell
tell application "Mail"
            set newMessage to make new outgoing message with properties {subject:theTitle, content:theBody}
            tell newMessage
                        -- Default is false. Determines whether the compose window will
                        -- show on the screen or whether it will happen in the background.
                        --comment next line for real use
                        set visible to true
                        set sender to "<Fill_IN_EMAIL>"
                        make new to recipient at end of to recipients with properties {name:"posterous", address:"posterous@posterous.com"}
                        
                        --send --un comment this send to send
            end tell
end tell

Loading mentions Retweet

Comments (2)

Jan 05, 2009
Sachin Agarwal said...
Very cool! just tried it out now and it works.

i think you may be missing some escaped quotes in your div?

Jan 05, 2009
John Johnston said...
Yep it looks like I mangled the script a bit when formatting it. I think there are lot of interesting things that could be dome with appleScript and posterous. Would it be hard to add appleScript to posterous' syntax colouring?

Leave a comment...

 
Got an account with one of these? Login here, or just enter your comment below.
Posterous-login    Connect    twitter