• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Launch Default Mail App attached the file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Launch Default Mail App attached the file


  • Subject: Re: Launch Default Mail App attached the file
  • From: John Delacour <email@hidden>
  • Date: Mon, 18 Nov 2002 23:18:21 +0000
  • Mac-eudora-version: 5.3a9

At 10:05 am -0500 18/11/02, Paul Skinner wrote:

Ok John, I've been following your discussions about Mail from a distance. After stopping and trying to script it a bit, I see why it makes you so mad. It's screwy!

The Create new message script <file://localhost//Library/Scripts/Mail scripts/Create New Message.scpt>seems to do this all well enough though. IJmust say that it's a bit like like hearing a story from a German tourist translated through a French guide. It works and makes sense, but it doesn't proceed in the way that you'd think it would.

Once you've cleared the major clutter from the script and given proper names to the variables, you are still left with something that only works by the skin of its teeth. If you change the syntax to variants that ought to be allowed, eg.

tell msgref to tell its content to set it to "hello"

it doesn't work, and yet you can tell its content to make NEW attachment after its last paragraph. I came across three or four similar holes in the processing as I was doing this one script. The thing simply doesn't hang together or obey any of the established rules.

Here's (about) the shortest way I've found to make the new message, and what a bloody mess it looks!

tell app "Mail" to tell second account
set att_ to alias "dx:Users:jd:Documents:c.txt"
set from_ to full name & " <" & email addresses & ">"
set toList to {{name:"JD", address:"jd@home"}, \
{name:"JD", address:"jd@work"}}
set msg to make outgoing message
tell msg
set {visible, sender} to {true, from_}
set subject to "Test"
repeat with r in toList
set toRecip to make to recipient at \
end of to recipients with properties r
end repeat
set its content to "Hello" & return & return
make attachment at after last paragraph of \
its content with properties {file name:att_}
end tell
end tell

Compare this with Eudora:

tell app "Eudora" to tell (make message at end of mailbox "Out")
set its personality to (a reference to my personality 1)
set field "to" to "JD <jd@home>, JD <jd@work>"
set subject to "Test"
set body to "Hello"
attach to it documents {alias "dx:Users:jd:Documents:c.txt"}
end tell

Cricket says he's sorry to disappoint me and he's not scrapping it and starting again. Well so be it. Noone except a lunatic is ever going to bother scripting Mail unless the aete is completely overhauled by non-aliens. I strongly advise him to reconsider, and I'm sure the great majority of the denizens of this list will agree, once they've tried working with this appalling mess.

JD
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Launch Default Mail App attached the file (From: Paul Skinner <email@hidden>)

  • Prev by Date: Error trap if item cannot be made into an integer?
  • Next by Date: Digesting the digests ...
  • Previous by thread: Re: Launch Default Mail App attached the file
  • Next by thread: Re: Launch Default Mail App attached the file
  • Index(es):
    • Date
    • Thread