• 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: Scripting Mail
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scripting Mail


  • Subject: Re: Scripting Mail
  • From: Pat Stanford <email@hidden>
  • Date: Tue, 11 Apr 2006 08:39:38 -0700

On Apr 11, 2006, at 8:15 AM, Luther Fuller wrote:

Here is a short script that ought to work:

tell application "Mail"
    set theMsg to (some message of mailbox "TEST")
    set theRecipient to (some recipient of theMsg)
    set theAddress to address of theRecipient
    tell me to display dialog theAddress as text
    set theName to name of theRecipient --< problem here
    tell me to display dialog theName as text
end tell

If the message has a recipient address, then the first 'display' will show the address, but then the second 'display' always errors with "The variable theName is not defined." indicating that the line 'set theName to ...' is non-functional. But why? According to Mail's dictionary, this line is correct. Since I've never scripted Mail before, I have to ask ...

Is the problem with me or with Mail?

I get the variable not defined happens on messages where there is no name defined, only an email address. Try it with a message that you know has both a name and email address for the recipient.


I think you will have to wrap a try block around the set name section.

Pat Stanford
Coviana, Inc.
email@hidden


_______________________________________________ Do not post admin requests to the list. They will be ignored. Applescript-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Scripting Mail (From: Luther Fuller <email@hidden>)

  • Prev by Date: Re: Floating Palette To Launch Compiled Scripts ?
  • Next by Date: Replace names of files in different folders
  • Previous by thread: Scripting Mail
  • Next by thread: Re: Scripting Mail
  • Index(es):
    • Date
    • Thread