Re: Applescript: referring to selected email in Mail



In article <1hanbej.g6dswt14ncbaaN%me3@xxxxxxxxxxx>, zoara
<me3@xxxxxxxxxxx> wrote:

Okay, so this should be dead simple but I just can't work it out, and
nowhere on the web seems to have a script that does this.

"dead simple" is never a phrase that comes to mind when I'm dealing
with AppleScript.

How do I refer to a message (and/or number of messages) that are
selected in Mail? I have a bunch of actions I want to perform on a given
email(s) but can't refer to them! For example's sake, let's say I want
to display a dioalog saying who the email is from...

I got this to work:

set msgs to selection
repeat with this_message in msgs
set adr to extract address from sender of this_message
display dialog "message is from " & adr
end repeat

I tried "repeat with this_message in selection", which didn't work. I
have no idea why.

[snip]

There's something about Applescript syntax that completely flummoxes me;
I've downloaded manuals and sample code but I Just Don't Get It. Argh.

Ditto.

i.

--
Remove all numbers to reply.
.



Relevant Pages

  • Re: Applescript: referring to selected email in Mail
    ... repeat with this_message in msgs ... set adr to extract address from sender of this_message ... I tried "repeat with this_message in selection", ... so I whipped up a script to do just that. ...
    (uk.comp.sys.mac)
  • Re: Applescript: referring to selected email in Mail
    ... nowhere on the web seems to have a script that does this. ... repeat with this_message in msgs ... set adr to extract address from sender of this_message ... I tried "repeat with this_message in selection", ...
    (uk.comp.sys.mac)
  • Re: One category disappeared
    ... set chosenCategoryName to choose from list with title "Category Selection" with prompt "Select a category to be applied to Group Members..." ... repeat until catCreated ... set creationResult to display dialog "Name for new category..." ... set chosenCategory to ...
    (microsoft.public.mac.office.entourage)
  • Re: Batch Editing Contacts
    ... No way to "batch edit", exactly, but a script can select a group of contacts ... set theList to the selection ... repeat with theC in theList ... set theID to (the ID of theC as string) ...
    (microsoft.public.mac.office.entourage)
  • Re: Why is "Allow row to break across pages" greyed out?
    ... The check box for "Repeat as heading" will be disabled if the selection does ... Suzanne S. Barnhill ...
    (microsoft.public.word.tables)