How to refer to a message window in Mail.

How do I refer to a message that is in the frontmost window in Apple Mail? I have a Filemaker script that saves a report as PDF and attaches it to a new email message in a new window. Now I want to use Applescript to enter email addresses in the To: and CC: fields in the new email message containing the attachment.
All the examples I find refer to making a "new outgoing message" such as this:
tell application "Mail"
set newMessage to make new outgoing message with properties {subject:theSubject, content:theMessage}
tell newMessage
set sender to theSender
make new to recipient at end of to recipients with properties {address:theRecipient}
end tell
end tell
This won't work since I already have a new message. All I want to do is enter new recipients. But it seems I need to refer to this message as something more than "the front window".
Any ideas?
  Mac OS X (10.4.7)  
  Mac OS X (10.4.7)  

01. In 'FileMaker Pro Advanced' the following fields, in the order shown, were created:
Sender: (field 1)
To:
cc:
Subject:
Message: (field 5)
-- The code below works with the above fields.
set tFlag to 0
set tLIst to {}
tell application "FileMaker Pro Advanced"
activate
set tFields to (fields of (current record of database 1))
set {tSender, tRecipient1, tRecipient2, tSubject, tMessage} to {(item 1 of tFields), (item 2 of tFields), (item 3 of tFields), (item 4 of tFields), (item 5 of tFields)}
-- 'Command 1' is my 'New Script', wiich calls 'Send Mail'.
tell application "System Events" to tell process "FileMaker Pro Advanced" to keystroke "1" using command down
end tell
tell application "Mail"
activate
set eAddresses to (email addresses of accounts)
repeat with i in eAddresses
copy (item 1 of i) to end of tLIst
if ((item 1 of i) is equal to tSender) then set tFlag to 1
end repeat
if (tFlag = 1) then
repeat until ((name of window 1) is "New Message")
end repeat
delay 1
tell application "System Events" to tell process "Mail"
-- Exercise for the student
end tell
set nMessage to (outgoing message 1) -- Targets the front most 'Mail' window for the following actions.
tell nMessage
set visible to true
make new to recipient at end of to recipients with properties {address:tRecipient1}
make new cc recipient at end of cc recipients with properties {address:tRecipient2}
set subject to tSubject
set content to tMessage
-- send -- Un-comment when the above code is completed.
end tell
end if
end tell
Use 'tList' in the 'tell application "System Events" to tell process "Mail"' ... 'end tell' block of code to properly set the e-Mail window's 'Account:' pop up menu, to the desired 'sender'.
  Mac OS X (10.4.4)  

Similar Messages

  • How can I set a default window in MAIL (10.6.8) so that it's 27" wide?

    I don't recall this problem pre-OSX. Opening MAIL (in Snow Leopard) results in a window that completely fills my iMac's 27" monitor, almost 100% of the time – even though when exiting MAIL I have all windows to a manageable size.
    How can I limit MIAL to a default window sufficient to contain a "normal" e-message?

    Shrink the window to the size you want, quit mail (may not even have to do that), and then the window will be that size until you change it.  Similarly for new message windows.  Mail remembers (or should remember) the size you set its various windows to.
    Update:
    Hmm, you say you did that.  So what happens if you try this from another account?  Also, FWIW, the mail preferences are kept in com.apple.mail.plist.  If you are willing to potentially loose your mail settings and recreate them then you could try removing that and starting over.

  • How does one show full message headers in Mail 8.1? The previous 'complete header' option has been replaced with a time consuming 'custom' choice.

    How does one show full message headers in Mail 8.1?
    he previous 'complete header' option has been replaced with a time consuming 'custom' choice.

    Customize your toolbar in Mail and add the All Headers button:

  • How to re-open a message window when it is behind the main window of Thunderbird?

    For writing a new message Thunderbird opens new window. Activating main window of Thunderbird hides this new window with new message behind Thunderbird.
    On my Mac how do I re-activate this new message window?
    I know of using Mission Control, but would like an easy way. Does a quick way exist? cmd-tab does not do the job. Maybe some other hotkey?
    Thanks

    Maybe alt+tab; this works in Windows and Linux. Both these OSes offer tools via the task bar to bring selected windows to the foreground. I really think this is a question about how to drive a Mac. ;-)
    You could also minimize or move the offending window to reveal the other one trapped behind it.

  • How do I resize email message window so I don't have to scroll across to read a message?

    How do I resize the email message window to accomodate a message so I can read it without having to scroll across to see it all?

    Tried pinching.... the only thing that happened was it brought up the Launch Pad.  ??
    Also tried double-clicking-- nothing happened.
    I tried both these suggestions with new mail and old saved mail.  Nothing happened....
    What to do??  What to do???    I know it can be done somehow... or maybe it was with Windows   ??
    Also regarding Klaus' comment:  The  text is too big, too wide-spread to all appear when I enlarge the window to the max.  Somehow the text must be "shrunk" to fit within the window.

  • How do I find duplicate messages in Apple Mail?

    Hi,
    How do I find (and delete) duplicate messages in Apple Mail ?
    I will have to verify about 1000 messages in different mailboxes, all in Apple Mail.
    My system: Mail 4.5 (1084) and Leopard 10.6.8.
    Many thanks,
    D.M.

    in any window on a mac, if you just type a letter on the keyboard, the selection in that window will go to a file beginning with that name.   In Eudora, if mail window was sorted by NAME and you typed "E" the selection would move to the last email received from a person who's NAME began with "E",  if you typed "El" it would move to the most recent email received from a person named "El"  if you typed "Ela"  the selection would move to the most recent email received from a person named "Ela".   If mail was sorted by SUBJECT, it would move to the SUBJECT with those same beginning letters.   In mac mail the selection doesn't pick the most recent email, but a completely random one, and it doesn't differentiate between subjects and senders.   If I type "josh" it goes to an email with subject: josh, from 2011, not the most recent email from my friend josh that I got yesterday, even though I have my mail sorted by name.   If I type "Karen", selection moves to an email received from Karen in 2010, not the one I received 2 weeks ago.    In other words, it's completely random and useless. 
    only way to find something in macmail is to type a name into search box, then organize by name, then scroll to that name, only sometimes those name emails are not sorted by date, so you have to look through to find the most recent one.  then once you found it, you need to delete what's in the search box, and reset the sortation to be by date in order to have a chronological listing of you emails.  In other words, many complicated steps instead of one simple one. 

  • How do I remove/disable the Windows 8 Mail App

    How can I remove the Windows 8 Mail App from my computer? I am unable to select another mail provider and I absolutely do not want to get my Passport aka Windows Live ID involved with my mail under any conditions whatsoever.
    I have a vbs script that installed another mail provider in IE9 but it doesn't seem to work with Windows 8/IE 11.   I want this mail application off my machine entirely.
    How do I accomplish that?     
    Athena

    Athena
    You don't need to un-install it but if you still want to simply right click the mail tile in start>uninstall.
    Wanikiya and Dyami--Team Zigzag

  • How do you white list messages in apple mail

    What is the procedure to whitelist messages in Apple Mail?

    Whitelist how?
    Mark them as "not junk?"

  • Photosmart C8180 - how to remove black ink message window

    I recently changed my black ink cartridge and now every time I hit print a window appears saying the cartridge is empty and to replace it.  I have to hit "continue" in order to get the printer to print.  How do make this window go away?  Donna

    Hi - You'll have to contact HP Support for assistance with resetting your printer for a different region.  This partricular reset should be covered under warranty.  Here is the contact information for South Africa.  They'll be able to reset the printer so it will accept the cartridges from South Africa.
    Hope that helps.
    Say Thanks by clicking the Kudos thumbs up. Please mark the post that solves your problem as an Accepted Solution so other forum users can utilize the solution.
    I am an HP employee.

  • Why are none of the groups in my Address Book showing up the address book tool in the new message window in Mail? Actually how do I get the two to match?

    I seem to have lost the groups from my Address Book in the address book tool in Mail. When I try to address a new email, all my contacts are grouped under all and the other groups found in my Address Book application are missing. Is there a way to get the groups to show up in the address book within Mail?

    When you make changes in AB, quit Mail for the changes to be added to Mail's database file. Reopen Mail and try it.

  • How do I open a new window in Mail with AppleScript?

    I have an AppleScript that opens Mail, but if Mail is open in the background, but no window is open, then the "activate" command simply brings the application to the front, instead of creating a new window. Is there another command that will open a window if there is no existing window?

    You could also use any one of the following six “keystroke” commands:
    tell application "Mail"
        activate
        tell application "System Events"
            keystroke "0" using {command down} --> Message Viewer ⌘0
            keystroke "1" using {command down} --> Inbox ⌘1
            keystroke "2" using {command down} --> Drafts ⌘2
            keystroke "3" using {command down} --> Sent ⌘3
            keystroke "a" using {option down, command down} --> Address Panel ⌥⌘A
            keystroke "0" using {option down, command down} --> Activity ⌥⌘0
        end tell
    end tell

  • How to not "read" Junk Messages In Lion Mail?

    In the new setup in Lion Mail, the left column now has the subject line and first couple lines of the message.
    To create any kind of action with the message, I have to select it.  It then appears on the right and is seen as opened mail.
    For most messages, this is okay, but for junk mailing (foreign entitities wanting money etc.), I don't want to open it but I do want to delete it.
    Does anyone know how I can delete without "selecting" the message and automatically opening it or do I just have to use the alternate older view of Mail that is provided?

    I second this... Some emails I don't want to see at all. (i.e. Prince SoNSo has left me a gazillion dollars, all I have to do is reply...) Is there and edit button in the new mail as similar to the one used on portables?

  • How do I clear unread message in Apple Mail?

    Using Apple Mail 6.6 on a MacBook Pro running OX X 10.8.5.  Our Exchange server is 2007/2010. Besides my Exchange mail, I have 2 Gmail accounts and one iCloud account in Apple Mail.  I have no issues with the Gmail or iCloud accounts.
    Currently, I have 34 "unread" message from my Exchange account in Apple Mail.  On my iPhone, iPad and Outlook (PC), I have 0 unread messages.  When I filter Apple Mail for unread messages, there are none.  It's as if these are phantom unread messages.  I did a rebuild of the Exchange account in Apple Mail and I deleted and re-installed the Exhange Account in Apple Mail.  And still I am left with these mysterious 34 unread messages.
    It is really annoying.  Any thoughts?

    Quit Mail. Force quit if necessary.
    Back up all data. That means you know you can restore the Mail database, no matter what happens.
    Triple-click anywhere in the line below on this page to select it:
    ~/Library/Mail/V2/MailData
    Copy the selected text to the Clipboard by pressing the key combination command-C. In the Finder, select
    Go ▹ Go to Folder
    from the menu bar. Paste into the box that opens (command-V), then press return.
    A folder window will open. Inside it there should be files with names as follows:
    Envelope Index
    ExternalUpdates.storedata
    Move those files to the Desktop, leaving the window open. Other files in the folder may have longer names that begin as above. Move those files, if any, to the Trash.
    Log out and log back in. Relaunch Mail. It should prompt you to re-import your messages. You may get a warning that the index is damaged and that Mail has to quit. Click OK. Warning: The process may take hours if you have gigantic mailboxes. For reasonable-sized mailboxes, it should only take a few minutes.
    Test. If Mail now works as expected, you can delete the files you moved to the Desktop. Otherwise, post your results.

  • How Do I Include Original Message Headers in Mail replies!

    Hi,
    I would very much like to have all of the orginal email headers of the email I am responding to in my email replies.  All I can get get is something like:
    "On Jan 16, 2014, at 10:13 AM, United Airlines, Inc. <[email protected]> wrote:"
    I want:
    "-----Original Message-----
    From: "United Airlines, Inc." <[email protected]>
    Date: Thursday, January 16, 2014 at 10:13 AM
    To: Joe Schmoer <[email protected]>
    Subject: Link to mobile boarding pass(es) for confirmation EHXCKR"
    PLEASE tell me how I can do that in Apple Mail
    Thanks!

    The color of the font is determined by the recipient's email client. So you could change it, but it would depend on the recipient's settings.
    And besides, blue is harder to read.

  • How to find missing unread message in mac mail

    Hello,
    I have one unread message that I can not find, it is perhaps one of the mailchains I have. I organized my folder sort by unread and I can not find it neither. Please advise me how to find it.
    Thank you,
    Diana

    Something happened and is fixed.

Maybe you are looking for

  • I Would Like to Find an iPhone 4S Case that Is what My Sis Wants.

    I was first going to get some info from Apple Maniacs. If they think the iPhone 4S has one of the best HD video in their iPhone 4S?  I am just curious about this question If you get a chance read my post and se if you have any ideas.  Thanks This per

  • AIX 64 Bit - Oracle 11.2.0.3 Installation/Upgrade - 10.2/11.1

    AIX 64 Bit Oracle 11gR2 - 11.2.0.3 As part of the 11gR2 install, you are asked to select DBA and DBOPER owners. How is this determined/verified selected properly? Also, migrating DB's: Ran the dbupgdiag.sql and utlu112i_3.sql Should we enable 11.2 li

  • Flattening causes Empty Audio Region

    I've been trying to flatten a few of my comps and when I do, an entirely separate comp on the board disappears. It's weird. I click flatten and merge and a comp that's completely separate on the board disappears and turns white. Does anyone else know

  • Error when importing Flash

    When I try to import .swf files into Captivate 4, I get the following error message: The Adobe Flash File contains action script that references 'root'. This might cause the Adobe captivate project to work incorrectly or to stop working. Do you want

  • 2EETW169 no connect possible: "DBMS = ADABAS D

    Hi all, when we execute the command R3trasn - d  we obtain the following error: "ETW000  [dbsdbsql    ,00000]  *** ERROR => Connect to database failed, rc = -4008 (POS(1) Unknown user name/password combination)". In the past we think that somebody ha