danuel36 / telekinesis

Automatically exported from code.google.com/p/telekinesis
0 stars 0 forks source link

E-mail this document to me #93

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
An enhancement: 

Browsing my documents works great. How about allowing Word, Excel, PDF, JPEG, 
and text 
documents to be sent to the iPhone?

Just E-mail the document as an attachment to an address specified in the 
preferences.

Original issue reported on code.google.com by a...@mac.com on 13 Jul 2007 at 3:40

GoogleCodeExporter commented 8 years ago

Original comment by bwhit...@gmail.com on 14 Jul 2007 at 8:34

GoogleCodeExporter commented 8 years ago
Here is an applescript that I got from
http://developer.apple.com/qa/qa2001/qa1018.html that should allow the sending 
of an
attachment.  It will need to be modified for your purposes:

tell application "Mail"
    (* MAIL APPLICATION VERSION *)
    set mailversion to version as string

    (* SPECIFY DISPLAY OR SEND OPERATION - if displayForManualSend
    is true, then the message is prepared and displayed in a window
    for the user to send it.  if displayForManualSend is false, then
    the message is sent right away.*)
    set displayForManualSend to true

    (* SPECIFY GENERAL CONTENT OF MESSAGE *)
    set bodyvar to return & return & "Test body."
    set addrVar to "bogus@apple.com"
    set addrNameVar to "Guinea Pig"

    (* SPECIFY ATTACHMENTS *)
    (* This list of files represents another setting of *)
    (* the SendMail scriptstep. *)

    (* NOTE: A "mailto" URL does not allow for *)
    (* the specifying of attachments... *)
    set fileAttachThis to choose file of type "TEXT"
    set fileList to {fileAttachThis}

    (* DEFINE THE SUBJECT LINE *)
    set subjectvar to "Test Message From AppleScript with Attachment!"

    (* CREATE THE MESSAGE *)
    set composeMessage to (a reference to (make new compose message ¬
        at beginning of compose messages))
    tell composeMessage
        make new to recipient at beginning of to recipients ¬
            with properties {address:addrVar, display name:addrNameVar}
        set the subject to subjectvar
        set the content to bodyvar
        tell content
            repeat with aFile in fileList
                make new text attachment ¬
                    with properties {file name:aFile} ¬
                    at before the first word of the ¬
                    first paragraph
            end repeat
        end tell
    end tell

    (* SEND OR DISPLAY THE MESSAGE *)
    if displayForManualSend then
        set messageEditor to make new message editor ¬
            at beginning of message editors

        (* the following is a work around for a bug fixed in later
        versions of the Mail application that was present in versions
        1.0 and 1.1.  *)
        if mailversion is "1.0" or mailversion is "1.1" then
            set compose message of last message editor to composeMessage
        else
            set compose message of first message editor to composeMessage
        end if
    else
        send composeMessage
    end if
end tell

Original comment by ryano...@gmail.com on 20 Jul 2007 at 8:37