Using AppleScript to save Mail messages?

I'm a bit of an Applescript newbie, but I'm trying to attach an AppleScript to a rule in Mail to automatically save the raw text source of certain mail messages to a folder, where I can further process them.
Here's what I have so far. It compiles, is saved in my Mail scripts folder, and It is attached to the rule in Mail, but I get no evidence that it runs (no output file(s), no dialogs, no messages in the console or system logs).
using terms from application "Mail"
on perform mail action with messages theMessages
tell application "Mail"
repeat with eachMessage in theMessages
save the source of eachMessage in "hd/Users/me/Desktop/slash.txt" as text
save the source of eachMessage in "hd:Users:me:Desktop:colon.txt" as text
end repeat
end tell
end perform mail action with messages
end using terms from
Any suggestions?
G4 "Gigabit" Dual-500   Mac OS X (10.4.8)   1.5GB RAM, 1TB internal, SCSI, 802.11g, USB2.0

Hi 0g,
Automator is pretty simple compared to AppleScript. I use Automator, but I certainly could not help you with AppleScript! So I'm not sure you will find your answer here... You might, but why don't you increase your chances by posting in the AppleScript Forum here: http://discussions.apple.com/forum.jspa?forumID=724
(You probably didn't see that one as it is hidden in the Mac OS X Technologies Category!)
Good luck!
Guylaine
Mac mini Intel Core Duo 1.66 GHz 512MB DDR2 SDRAM Mac OS X (10.4.8) G4 Digital Audio Mac OS 9.2.2, iPod nano 1GB, iPod nano 4GB

Similar Messages

  • How can I save mail messages to my computer and not my mail program

    My mail program seems to be slow.  I'm not sure why.  I get the spinning ball frequently.  I need to save mail messages sometimes for a few years and there are hundreds of emails. Is it better to save them on my computer than my mail program?  I may need to retrieve them at some other time so they need to be readable.  Is that possible?
    I'm using OS X 10.9.4. I have a 3.06 GHz processor and 12 GB of memory.  Thanks

    You can select to export a folder to save as a .mbox file. This file would need to be imported if you wanted to view the messages.
    Select mailbox (folder)
    Under Mailbox in the Menu bar select Export Mailbox...
    You might also want to check out the demo for EagleFiler by the author for SpamSieve. You could view and search the messages archived in EagleFiler.
    http://c-command.com/eaglefiler/
    Regarding Mail being slow....
    Is it only Mail that is slow?  How much free space on your drive? Use Disk Utility to find available space.

  • Having problem deleting all but one particular mail from the iPhone 4S mail inbox. I can delete mail either by the trash can or using edit, selecting the mail message and deleting.  However there is this one mail message that will not go away. Any ideas?

    I am having a problem deleting all but one particular mail message from my inbox. I delete by either using the trash can icon for individual mail, or using edit, selecting the mail message (s) and clicking delete.  However there is this one mail message that will not go away regardles of what I do including deleting all from the trash.  Any ideas?

    I get that every once in a while on my 3GS, and that's what I do to get rid of it. Probably not a bad idea to power down the phone every so often, anyway, gets rid of any crud waiting to cause a bug.
    Glad to hear that it worked for you.

  • How can I save mail messages on iPad

    I (strictly, my wife) have just bought a WiFi-only iPad to replace an ageing MacBook, and I also have an iMac.  I have a need to store and organize a limited number of Mail messages in the iPad, such that they are available in the future when I do not have internet access - i.e. while travelling.  These are varied, but typically contain reference information, reservation details, receipts, directions, etc.
    Previously, this was easy to do with the MacBook.  I set up our GMail account as POP3, and filed such messages as we needed in as many Filed Mail mailboxes as I wanted.  Unfortunately, if you set up a Mail account as POP on the iPad, you can't define Filed Mail mailboxes.  And if you set up the account as IMAP, you don't have access to your filed mail when not connected to the internet.  So you're damned if you do, and damned if you don't.
    So here's the question.  Is there any organised way to save messages permanently on the iPad?  And any attachments need to be kept as well.  While strictly they no longer need to be in Mail format (i.e. can't be forwarded or replied to), that would be a less convenient approach, and those all-important attachments would have to be dealt with.  But I am willing to be flexible.
    And before anyone says that POP will not work with multiple devices, GMail POP has a feature that allows the same email to be downloaded to multiple devices as well as being held on the server if required, and all sent emails are also echoed back to all devices (the "recent" feature).  This has worked fantastically up to now.
    Any help would be appreciated.

    Do you need to be able to initiate this entirely from the iPad, or would it be acceptable to have to use one of your Macs when you save one of the limited number of messages? If involving a Mac would be acceptable, I can see ways to work around the iPad's lack of local mailbox storage.
    You could use one of the various free cloud storage services that allow general file storage and local retention on the iPad (for example, Dropbox or Dump Truck, but not iCloud).
    For Dropbox, you would make a folder for this cluster of saved messages inside Dropbix. For each message you want to save, create a folder inside that cluster folder, do a "Save As..." in Mac Mail.app for the text body, then a "Save Attachments..." if appropriate. (The inner folder wouldn't be strictly necessary for messages without attachments, but I suggest it for consistency.)
    The key part is to open Dropbox on the iPad and mark the message and attachments as favorites (starred). That causes Dropbox to preload them on the iPad and retain them there until they are unstarred (lose favor).
    You could probably do something similar with Evernote and favorites.

  • Batch save Mail messages as PDF's

    I am in need of saving all of my email messages in my inbox as individual PDF documents. I know you can do it one at a time via "Print>save as PDF" but we are talking about a few hundred email messages here.
    Is there anyway to take advantage of something like automator or could someone show me some software to batch save all of these messages?
    Thanks so much for the help.
    -Christian

    Dansyacht wrote:
    In Mail, select all the messages to print (a smart mailbox may help).  When all are selected do a file > save as (RTF or plain text).  This will create one printable file with all the messages.  You can then load this file into TextEdit and print it as a PDF.
    Thanks -- this may be what I go with.  However, when I tried this the rtf file did contain all of the messages, but did not show the header information on each (To:, From:, Date: ...), so I continued my search for a solution.  I think I found something that works.  My project is actually larger than what I described.  Interested people may be able to use some or all of the following.
    The project started when I asked a friend to send me all of the emails that I have sent him over the last 15 years.  He had archived them all in Windows / Outlook Express.  I had not archived them.  He was able to give me a .DBX file containing them all.  I used a free program called DbxConv in Windows to convert the .DBX file to a .MBX file.
    In Apple Mail I did File/Import_Mailboxes/File_In_mbox_Format to import them.  Then, View/Organize_by_Conversation (checked on).  Select all messages and File/Print/PDF/Save_As_PDF into a new folder on the desktop.  This will generate many pdfs.
    Now the new part:
    Next, drag all of the PDFs into Preview.  Finally, in Preview, File/Print/PDF/Save_As_PDF.  This will create a single pdf file with all messages, including imbedded attachments, with info displayed in your current Apple Mail format -- dependent on how you like your Apple Mail messages displayed (minimal header, expanded header, etc.) . . . . .  I think!
    At least it worked for me, once.  I try it again and see what develops.

  • Simple AppleScript to export Mail messages to FileMaker DB?

    Hello everyone,
    I'm using a product called "Mail Archiver X" to archive messages from Apple Mail into a custom FileMaker database ("eMailViewerX" - this is the target database that comes with Mail Archiver and is required for the process), from where I copy these messages to my main message archive (another FileMaker DB).
    While that process works, it is kind of clumsy (Apple Mail > Mail Archiver X > FileMaker DB #1 > FileMaker DB #2) - and it breaks every time when there is a new version of Apple Mail or OS X until "Mail Archiver X" has been updated by the developer.
    So I'm looking for a more simple solution: an AppleScript that will export all messages from exactly one folder ("To Archive") in Apple Mail (4.5/Snow Leopard or 5.0/Lion) as a simple CSV or .tab file, with the following data per line:
    Message Sender*
    Message Receiver*
    Sent Date
    Sent Time
    Subject
    Body
    * Separation of name and e-mail address would be cool, but I understand this may not (always) be possible.
    The only tricky part may be the conversion of carriage returns in the e-mail messages' body into the special character FileMaker expects in TAB or CSV files. In BBEdit, this is shown as \x{0B} (UTF8: 0B). So there would have to be a Find/Replace for that in the script.
    This does not have to be free (although I wouldn't mind - I'd gladly pay for something that is simple and reliable.
    If someone knows about such a script or is willing to write it, I would really appreciate it.
    TL;DR: I want to export all messages from an Apple Mail folder to a FileMaker-readable CSV file.

    You haven't fully specified the problem:
    It's not clear what to do when there are multiple recipients of an email
    You didn't say precisely what Filemaker fields you wanted in the file, nor what order you wanted them in, nor whether you needed a header row in the text file
    That being said, what you want is a script somewhat like the following (with many things still needing to be adjusted):
    set archiveFolder to "To Archive"
    set tab_delFilePath to "Path:to:tab_del file"
    set tab_delText to {}
    tell application "Mail"
              set messagesToArchive to every message of mailbox archiveFolder
              repeat with thisMessage in messagesToArchive
                        set thisEntry to {}
                        tell thisMessage
                                  set {itsSender, itsRecipients, itsDate, itsSubject, itsText} to {sender, recipients, date received, subject, content}
                                  set {senderName, senderAddress} to {extract name from sender, extract address from sender}
                                  if senderName = senderAddress then set senderName to ""
      -- get date parts
                                  set itsDateString to short date string of itsDate
                                  set itsTimeString to time string of itsDate
      -- there may be multiple recipients; create list
                                  set {recipientName, recipientAddress} to {{}, {}}
                                  repeat with thisRecipient in recipients
                                            tell thisRecipient
                                                      set recipientName's end to name
                                                      set recipientAddress's end to address
                                            end tell
                                  end repeat
      -- convert carriage returns to linefeeds in message body; unicode 0B is ascii 11, which is linfeed
                                  set itText to my tid(my tid(itsText, return), linefeed)
                                  set thisEntry to {senderName, senderAddress, itsDateString, itsTimeString, itsSubject, my tid(recipientName, ","), my tid(recipientAddress, ","), itsText}
                        end tell
                        set end of tab_delText to my tid(thisEntry, tab)
              end repeat
    end tell
    set tab_delText to tid(tab_delText, return)
    set fp to open for access tab_delFilePath with write permission
    write tab_delText to fp
    close access fp
    on tid(input, delim)
      -- a subroutine for handling text item delimiters
              set {oldTID, my text item delimiters} to {my text item delimiters, delim}
              if class of input is list then
                        set output to input as text
              else
                        set output to text items of input
              end if
              set my text item delimiters to oldTID
              return output
    end tid
    it's a place to start, anyway. 
    If you want to dangle money in front of my eyes, send me an email and I'll get it set up properly on your system (including automating the process and importing the data directly into your filemaker database).

  • Applescript to save email messages feasible?

    Can someone tell me if this is feasible? If it is I might try and learn Applescript to write it.
    At work we have a problem trying to get people to file emails correctly. We want each email to be saved to their respective project folders on the server as RTFs (or ODFs).
    So I'm wondering if the following Applescript is feasible?
    1) Open a read email, normal behaviour would ensue
    2) Open an unread email and a separate dialogue window pops up, prompting the user to choose a filename and somewhere to save the message (this should include the ability to choose a filename by clicking on existing files, as in a normal save dialogue).
    3) If the email has attachments the same pop-up window, or a separate one, would prompt the user to choose a (possibly different) folder to save the attachments, and allow the user to choose which attachments to save, including none.
    4) Lastly the the same pop-up window, or a separate one, would prompt the user for a folder within Mail to move the message to.

    A native AppleScript possibility, - although, not via a single window
    With respect to '2) Open an unread email ...' - one could create a 'Rule' in 'Mail' to execute an AppleScript script.
    The AppleScript script would open each e-Mail message, present a 'choose folder' dialog box (consult 'Library' windows' 'StandardAdditions.osax' dictionary), followed by a 'display dialog' (with a 'default answer ""' entry) for file name entry, The information from the two (2) dialog box'es would be concatenated to form a new file path.
    With respect to '3) If the email has attachments ...' - the list of attachments, of each e-Mail message, would be looped (repeat ... end repeat) through - with a 'choose folder' dialog displayed as the destination of the attachment. Naturally, if the attachments' name is to be user editable - a display dialog (with a 'default answer '""' entry) would be required. Again, the information from the two (2) dialog box'es would be concatenated to form a new file path.
    Finally, with respect to '4) ... prompt the user for a folder within Mail to move the message to.' is possible by a 'choose from list' dialog box; where the list is of the 'Mailbox' names of 'Mail'.

  • Sandbox makes applescript to save Mail attachments fail

    I wrote a cocoa app to collect a set of email attachments and do some processing on them. The process is transparent to the user, who sees the end result of the attachment processing without having to deal with each individual attachment. The cocoa app runs an Applescript to tell Mail to save the attachements of messages having the given IDs to the cocoa app's Library/Caches/com.myCo.myApp folder. This fails since Mail has no entitlement to write to the cocoa app's cache folder.
    Where can Mail write, and can my cocoa app read it, or will sandboxing prevent this too?

    I wrote a cocoa app to collect a set of email attachments and do some processing on them. The process is transparent to the user, who sees the end result of the attachment processing without having to deal with each individual attachment. The cocoa app runs an Applescript to tell Mail to save the attachements of messages having the given IDs to the cocoa app's Library/Caches/com.myCo.myApp folder. This fails since Mail has no entitlement to write to the cocoa app's cache folder.
    Where can Mail write, and can my cocoa app read it, or will sandboxing prevent this too?

  • Having trouble using applescript to save pdf as excel spreadsheet

    I have been trying to use applescript to create an automator action to convert some downloaded PDF's to .xlsx format.  After reviewing a good bit of the SDK documentation, I came up with the following scripting:
    tell application "Adobe Acrobat Pro"
                                  open theFile
                                  save front document to file theNewFile using conversion "com.adobe.acrobat.xlsx"
      close front document
    end tell
    This script works fine when I use the "com.adobe.acrobat.plain-text" conversion or the png or jpeg conversion. However, I cannot get it to work with "com.adobe.acrobat.xlsx" or "com.adobe.acrobat.spreadsheet".  Note that although I didn't copy the code here that sets theNewFile variable, I have been changing it to the appropriate file extension when changing conversion strings.
    When I execute the script using one of the problem conversion strings, Acrobat opens the file successfully, but it just sits there, as if it does not understand the save command at all.
    I guess I should mention that the whole goal here is to actually convert the PDF's to CSV eventually.  The next step was going to be to open the file in Excel and save as CSV.  If anyone knows a *free* way to go straight from PDF to CSV using Applescript/Automator without having to go through all these other programs, I would be very appreciative for the suggestion.  This conversion is just a small part of a very lengthy workflow but it is causing me the most trouble.

    Hello Jonathan,
    Ok i have only one final question.
    Do you know how to work in photoshop, don't you? Ok i think yes.
    Well i have 2 ways to do that, i did one action from photoshop that will get the image inside folder and will convert this image in pdf. Abouve the line of script
    that you have to attach to folder action and the action for Photoshop.
    About the action for Photoshop give me your email address and I send you, or do it your self. You have to do this: open one image in JPG, go to action, go new set, put your name of set, put the name of action if you like you can change the name, go print with preview, print and set save as PDF close your file and stop the action.
    Now that you have to do is put all your files inside your folder and leave the Photoshop do it for you, ok?
    Good Luck
    Hack
    property speak_alert : false -- if true, the script will speak the alert. If false, the script will display an alert dialog
    property dialog_timeout : 30 -- set the amount of time before dialogs auto-answer.
    property copychecksindicator : false
    property itemcheck_delaytime : 2
    property foldercheck_delaytime : 3
    property speciallabelindex : 7
    on adding folder items to this_folder after receiving added_items
    if copychecksindicator is true then
    set the added_items to my checkaddeditems(the added_items)
    if the added_items is {} then return "no vaild items"
    end if
    tell application "Finder"
    activate
    set this_folder to choose folder with prompt "pdf"
    set these_files to every file of folder this_folder
    end tell
    tell application "Finder"
    repeat with i from 1 to number of items in these_files
    set this_path to (item i of these_files) as string
    tell application "Adobe Photoshop CS2"
    launch
    open file (this_path as string)
    set this_files to current document
    do action "Jpg" from "Jpg para Pdf"
    end tell
    end repeat
    end tell
    end adding folder items to

  • Using Applescript to track Mail "Mark as Unread"

    Hi,
    I'm new to actionscript, I've never written anything using it. I'm a web developer, so I know JS, PHP and languages like that, but Applescript seems quite different to me.
    Anyways, I would like to know if it is possible to have a script in the background with an event handler that will trigger additional actions when a message is marked as unread?
    Pretty much, I want some code (that I will work out later) to be executed when a user marks a message as unread in Mail. ("Message"->"Mark"->"As Unread" OR ⇧⌘U)
    Thanks

    I'm new to actionscript
    You mean AppleScript, right?
    I would like to know if it is possible to have a script in the background with an event handler that will trigger additional actions when a message is marked as unread?
    Not directly. The ideal way of doing this would be for Mail.app to have some kind of option to attach AppleScripts to events within the application. It's entirely possible to do within the OS, but few applications take advantage of it - that includes Mail.app, so there's no way to have Mail.app call your script directly.
    The closest you could get would be a background script that silently polled Mail.app for the status of all messages and somehow detect when a message went from Read to Unread. This could be unwieldy, especially if there are many, many messages in the mailbox - you pretty much have to keep track of every read message and scan for any unread messages that are in the previous read messages list. This option doesn't work if you want to perform some real-time action such as interact with the user since there would always be some delay between the user action (marking the message unread) and the script noticing it.

  • Using applescript to save an image to PDF?

    I'm still learning applescript, but I need a good one really quickly. I have several images that I need to save as PDF. Is there a way to do this through applescript? It will save me many, many hours of work over the next month.
    Thanks,
    Jonathan
    MacBook   Mac OS X (10.4.9)  

    Hello Jonathan,
    Ok i have only one final question.
    Do you know how to work in photoshop, don't you? Ok i think yes.
    Well i have 2 ways to do that, i did one action from photoshop that will get the image inside folder and will convert this image in pdf. Abouve the line of script
    that you have to attach to folder action and the action for Photoshop.
    About the action for Photoshop give me your email address and I send you, or do it your self. You have to do this: open one image in JPG, go to action, go new set, put your name of set, put the name of action if you like you can change the name, go print with preview, print and set save as PDF close your file and stop the action.
    Now that you have to do is put all your files inside your folder and leave the Photoshop do it for you, ok?
    Good Luck
    Hack
    property speak_alert : false -- if true, the script will speak the alert. If false, the script will display an alert dialog
    property dialog_timeout : 30 -- set the amount of time before dialogs auto-answer.
    property copychecksindicator : false
    property itemcheck_delaytime : 2
    property foldercheck_delaytime : 3
    property speciallabelindex : 7
    on adding folder items to this_folder after receiving added_items
    if copychecksindicator is true then
    set the added_items to my checkaddeditems(the added_items)
    if the added_items is {} then return "no vaild items"
    end if
    tell application "Finder"
    activate
    set this_folder to choose folder with prompt "pdf"
    set these_files to every file of folder this_folder
    end tell
    tell application "Finder"
    repeat with i from 1 to number of items in these_files
    set this_path to (item i of these_files) as string
    tell application "Adobe Photoshop CS2"
    launch
    open file (this_path as string)
    set this_files to current document
    do action "Jpg" from "Jpg para Pdf"
    end tell
    end repeat
    end tell
    end adding folder items to

  • Looking for an applescript to forward mail message in outlook

    Hi there...i'm looking for a simple applescript that will forward the selected message to a specific email address.  Thanks!

    Hi there,
    Did you got the answer already? I'm looking for the same thing
    I got someting already but he doesnt send the message.
    ---Script----
    set m   set myComment to "My comment: "
    set t    set theName to "test"
    set t    set theAddress to "[email protected]"
    try
                         tell application "Microsoft Outlook"
                                       set theSelection to selection
                                       set theForwardedMessage to forward (item 1 of theSelection) with opening window
                                       tell theForwardedMessage
                                                                                   open theForwardedMessage
                                                                                   make new to recipient at theForwardedMessage with properties {email address:{name:"test", address:"[email protected]"}}
                                                                                         send theForwardedMessage
             end tell
                         end tell
    e
    end try
    ----End Script-----

  • Using AppleScript to remotely shutdown a mail server?

    Hello all AppleScript gurus,
    Here is the situation. My friend's company (it is a small company) uses a Linksys NAS 200 as a mail server. They recently purchased an APC BackUps 1000 Pro as the universal power supply (yes I am aware that it is not suitable for business purposes, but the boss is a cheapskate).
    I would like to be able to shutdown the server remotely when the UPS tells the mac laptop (running 10.7.5) that power is being supplied by the battery. However, APC's software for OS X is nonexistant, and the options in energy saver in system prefs are limited.
    Would it be possible to use AppleScript to send a message to the server to shutdown upon receiving a warning from the UPS? If so, how would this be accomplished?
    Many thanks in advance in case I forget to say thank you again after. If further information is required, I'll do my best to supply the info.
    Thanks again.
    Ian

    I'd figure out how to do the shutdown from the command line.  You then should be able to do this from an applescript.
    There is some way of initiating an apple script on a remote machine but I do not know how.
    What OS is the remote server using?
    Robert

  • Using AppleScript to find specific text in mail message?

    I'm new to scripting, and I'm a bit lost on this one...
    Is there any way to use AppleScript to find a file name from within the body of a mail message so it can be used later in the script?
    Specifically, I want to use AppleScript to "read" the content of a mail message and look for a paragraph that says "Filename: MyFileName" so I can set "MyFileName" as a variable. (There will always be a paragraph that begins with "Filename: " in this particular email message.)
    This will part of a larger script that uses Fetch to download "MyFileName" from our FTP server.
    Thanks in advance for any ideas - I'm struggling with this one.
    Andy Gill

    Ok, red_menace above me had a shorter and more elegant solution to the question, I'm adding this just for another example.
    To solve your problem I'd make a mail rule that looked for any messages with "Filename:" in them (along with whatever criteria you wanted, like sender, domain, etc). The mail rule would execute the Applescript. My assumption is that the "Filename:foobar" text could be anywhere in the email, not necessarily the first thing in a paragraph, so I had to parse it differently.
    The results end up in a datalist, (theFilename {} ) that you can parse later to collect all filenames found in whatever messages were processed.
    I realize this could be cleaner, hope it's not hard to follow, but I did it really fast. It works flawlessly for me, picking out the name of the file no matter where in the email it appears.
    using terms from application "Mail"
    on perform mail action with messages theSelectedMessages for rule theRule
    repeat with aCounter from 1 to count theSelectedMessages
    set theMessage to item aCounter of theSelectedMessages
    set theContent to content of theMessage
    set theWords to every word of theContent
    set theFilename to {}
    set tid to AppleScript's text item delimiters
    set AppleScript's text item delimiters to ":"
    repeat with thisLoop in theWords
    try
    if (text item 1 of thisLoop) is "Filename" then
    set end of theFilename to (text item 2 of thisLoop)
    -- rest of your logic goes here the display is just to show it finds the filename, take it out!
    display dialog theFilename ¬
    buttons {"OK"}
    end if
    end try
    end repeat
    set AppleScript's text item delimiters to tid
    end repeat
    end perform mail action with messages
    end using terms from
    Message was edited by: stephen.bradley Typos for the win!

  • AppleScript To Save Messages As PDFs With Specific Naming Convention

    I am looking for an Applescript that:
    1: Prompts and allows the user to select one or more Apple Mail email messages from within Mail (10.4, 10.5, 10.6).
    2: Prompts and allows the user to select a save-to folder.
    3: For each message, saves it as a PDF file in the save-to folder, using the following naming convention for the PDF file:
    "YYYY-MM-DD HH.MM.SS Email From FIRSTNAME LASTNAME - SUBJECT",
    "YYYY-MM-DD HH.MM.SS Email To FIRSTNAME LASTNAME - SUBJECT",
    where in the email date-sent stamp (if I am the sender) or date-received stamp (if I am the recipient):
    YYYY = the year
    MM = the two-digit month
    DD = the two-digit day
    HH = the two-digit hour (in 24-hour time)
    MM = the two-digit minute
    SS = the two-digit second
    FIRSTNAME is the email sender's first name for email that I receive (or is the email recipient's first name for email that I send)
    LASTNAME is the email sender's last name for email that I receive (or is the email recipient's first name for email that I send)
    SUBJECT = the email's subject line
    For example: 2010-04-10 16.32.48 Email From Kris Ryan - Status Of Payroll Updates.pdf
    For example: 2010-04-10 16.33.55 Email To Sue Anderson - RE Status Of Payroll Updates.pdf (Colon omitted after "RE".)
    4: For each attachment to the message, saves it as a PDF file in the same directory using the naming convention:
    "YYYY-MM-DD HH.MM.SS Email From FIRSTNAME LASTNAME Z Attachment - NUMBER - FILENAME",
    where:
    YYYY-MM-DD HH.MM.SS Email From FIRSTNAME LASTNAME = as above
    NUMBER = an integer representing the attachment number (1, 2, ...) sorted according to filename alphabetical order
    FILENAME = the name of the file attached to the email, including its extension (.docx, .xlsx, etc.)
    The letter "Z" sorts the attachment PDFs after its respective parent email in the directory.
    For example: 2010-04-10 16.32.48 Email From Kris Ryan Z Attachment - 1 - List Of Suggestions To Moore.doc.pdf
    For example: 2010-04-10 16.32.48 Email From Kris Ryan Z Attachment - 2 - Proposed Salary Adjustments.xls.pdf
    For example: 2010-04-10 16.32.48 Email From Kris Ryan Z Attachment - 3 - Salary History.pps.pdf
    Note: The email attachment may consist of a PDF or MS Office file (Word, Excel, Power Point); however, a smart implementation will be able to handle any attachment kind. If the attachment is a PDF file, then save it "as is" using the stipulated naming convention, without passing it through Distiller.
    Thank you.
    Kurt Todoroff

    Well, that's quite a spec sheet.
    Here's a start, you can easily edit the script to get what you need:
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    font-weight: normal;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px; height: 340px;
    color: #000000;
    background-color: #E6E6EE;
    overflow: auto;"
    title="this text can be pasted into the AppleScript Editor">
    Set a Mail Rule to Save Message and Attachment to Desktop.
    To save attachments to another another folder on the desktop (i.e. Attachments) create the folder and then
    change tell application "Finder" to set pathToAttachments to (path to desktop folder as string) & "Attachments:"
    using terms from application "Mail"
    on perform mail action with messages theMessages
    tell application "Finder" to set ptd to (path to desktop folder) as string
    tell application "Finder" to set pathToAttachments to (path to desktop folder) as string
    tell application "Mail"
    repeat with theMessage in theMessages
    set d_recd to date received of theMessage as string
    set d_recd to ReplaceText(d_recd, ":", " ") of me
    set d_recd to ReplaceText(d_recd, ",", " ") of me
    set theText to content of theMessage
    if theMessage's mail attachments is not {} then
    repeat with theAttachment in theMessage's mail attachments
    set theFileName to pathToAttachments & (theMessage's subject) & " (Attachment From " & (theMessage's sender) & " Sent " & d_recd & ")" & space & theAttachment's name
    try
    save theAttachment in theFileName
    on error errnum
    end try
    end repeat
    end if
    set theFile to ptd & (theMessage's subject) & " (From " & (theMessage's sender) & " Sent " & d_recd & ")" & ".txt"
    set theFileID to open for access file theFile with write permission
    write theText to theFileID
    close access theFileID
    end repeat
    end tell
    end perform mail action with messages
    end using terms from
    on ReplaceText(theString, fString, rString)
    set current_Delimiters to text item delimiters of AppleScript
    set AppleScript's text item delimiters to fString
    set sList to every text item of theString
    set AppleScript's text item delimiters to rString
    set newString to sList as string
    set AppleScript's text item delimiters to current_Delimiters
    return newString
    end ReplaceText</pre>

Maybe you are looking for

  • Edit Multiple Images in photoshop cs5

    I am trying to apply the same affects thru a action to about 50 some odd photos. I don't want to go thru them individually so how do you do them all at once? Can you convert them to smart objects then apply the action? I tried this but once i want to

  • Help!!  Please!  CF 8.0.1 Multi-Server/Solaris 10/WebServer 7

    Good afternoon, I'm having a bit of a bizarre problem, and I cannot locate the root cause. My environment is:  Sun E5220 running LDOMS V1.3 software.  I have a 4 processor node configured with Sun Solairs 10u5, Java SDK 1.6.0_25-b06 SE Runtime Enviro

  • Oracle data lookup (read) - Licensing query

    Hi, We are running SAP R/3 4.7 Enterprise with Oracle 9.2.0 as the backend database (on Windows Server 2003 OS). Our Oracle license is embedded with SAP i.e., not acquired separately. For business needs we intend to make read only queries to the back

  • Getting one swf to be higher than another in the zindex of a html page

    Hey all could someone please show me how I can tell one .swf to be higher in the pages object stack than an other, I presume using javascript? Any help would be great.

  • Issue Unlocking Gamer's Club Card

    I purchased a game online and the gamer's club at the same time back in June. They sent me the gamer's club and was told I needed to unlock it at a physical store. I went to my local BB and they could not figure out how to unlock it without charging