Applescript and Mail 2.x?

I'm currently using Mail 2.x in Tiger, and not having much luck figuring out how to create an Applescript or assign keyboard shortcuts that will let me select a specific signature without taking my fingers off the keyboard. I can use the mouse to select a signature, but that means I've got to take my hands off the keyboard--slow given the number of messages I send every day. Alternatively, I can enable "full keyboard access" to "all controls" in the Keyboard preferences pane, but then I burn out the Tab key having to move to and past the Signatures dropdown menu for each message, plus I still have to select the correct signature using the arrows. A single keystroke would be so much nicer!
Is there any way to assign a keyboard shortcut to an individual signature? I couldn't see anyway to do this via the Keyboard preferences panel, since the signatures aren't a menu choice.
Applescript seems to be the next most likely suspect, but I couldn't see any Applescript commands that would do this--again, they seem to relate primarily to menu commands and buttons rather than mouse clicks. Nothing obvious about selecting signatures.
I'd prefer not to invest in QuicKeys or similar software if I can learn to program it myself using the tools that Apple provides, so advice on scripting this would be my preference.
Thanks for any suggestions!
--Geoff

GL proposed the following Applescript to add a signature:
tell application "Mail"
activate
set om to first outgoing message
set message signature of om to signature "Signature #2"
end tell
Thanks for the suggestion. Good start, but we're not there yet. As a complete innocent with Applescript, I'm not sure how to tweak this to make it work. Here's some data to help you help me:
With a message open and ready to send before I try running the script, running the script produces the error message "The variable om is not defined." Is there a "currently open message" equivalent to "first outgoing message" that could be substituted in the script?
When I tried running that same script from the Script editor with a message displayed but not ready to send, there's possibly no outgoing message, so I got a different error. Should've had more coffee before trying this, but I'm passing this along in case it's useful troubleshooting info beyond "PLBKAC"*.
* Problem lies between keyboard and chair. <g>
Also, does "Signature 2" refer to a logical pointer (i.e., the second signature in the dropdown menu), or should the quoted text be replaced with the actual signature I want to insert? If the signature contains multiple lines, how would I format that in the script editor?
Last but not least, how do I bind the resulting script to a keyboard shortcut so I can run it in Mail without using my mouse? I didn't spot anything in the online help for AppleScript. Possibly from the Keyboard preferences panel?
Thanks for any additional thoughts.
--Geoff

Similar Messages

  • Applescript and mail rules:

    I'm trying to do something with rules that I can't easily do in preferences.
    I want to create a rule that does does the following:
    If from equals [email protected] OR  [email protected]
    AND
    message contains  "lawn"  or "Lawn" or "LAWN" or "XYZ" or "xyz" or "ABC"
    move message to mailbox M
    Or, do I just have to create a ton of rules?
    Also, assuming the answer to the above is true, I guess I could write a single apple script that did all my mail processing.
    I've searched and searched for such a script. Can anyone point me to something?
    I'm an applescript beginer.  I just ordered a book, but not here until next week.
    Thanks!
    Dave

    do it this way with an applescript (attach this to a rule action that checks all messages - will probably need some tweaking):
    set senderList to {"[email protected]", "[email protected]"}
    set keywordList to {"lawn", "Lawn", "LAWN", "XYZ", "xyz", "ABC"}
    using terms from application "Mail"
              on perform mail action with messages theMessages for rule theRule
                        tell application "Mail"
                                  repeat with thisMessage in theMessages
                                            if sender of thisMessage is in senderList then
                                                      repeat with thisKey in keywordList
                                                                if thisKey is in content of thisMessage then
                                                                          move thisMessage to mailbox "M"
                                                                end if
                                                      end repeat
                                            end if
                                  end repeat
                        end tell
              end perform mail action with messages
    end using terms from

  • AppleScript and Mail

    Hi,
    I am trying to write an Apple-Mail rule and AppleScript combination to print the content of email messages that meet the criterion specified by the rule.
    When an email arrives that meet the criterion, the rule runs and in-turn runs the AppleScript.  However, the script does not seem to get the contents of the message.
    Here is the script:
    on run
        -- For debugging to indicate that the script is running
        display dialog "Running script"
        tell application "Mail"
            set theText to content of message
            -- Display the text for debugging purposes.
            display dialog theText
            -- The remainder of the script passes the text to a
            -- "do shell script" for printing.
        end tell
    end run
    When the script runs, nothing happens.  The text is not displayed and
    there is no error message.
    If I rewrite the script to run manually with a selected message, it works ok.
    on run
        tell application "Mail"
            set theMessage to item 1 of selectedMessages
            set theText to content of theMessage
            display dialog theText
        end tell
    end run
    Any ideas or help would be appreciated.
    SyB

    This works for me:
    using terms from application "Mail"
              on perform mail action with messages theMessages for rule theRule
                        tell application "Mail"
                                  repeat with eachMessage in theMessages
                                            set theText to content of eachMessage
                                            display dialog theText
                                  end repeat
                        end tell
              end perform mail action with messages
    end using terms from
    did you forget the on perform mail action with messages bit?  WIthout that, the script won't be able to get the message info from Mail.
    I'l add (just pro forma) that printing from the command line is circuitous.  Most likely you can skip extracting the content and sending it to unix and just say:
                                  repeat with eachMessage in theMessages
                                             print eachMessage
                                  end repeat

  • Using AppleScript in Mail Rules

    I can't figure out how to edit an AppleScript for Mail to perform the following:
    1) After moving a filtered incoming message to a prescribed folder (can do this easily), open the message in a new window (or go to the folder and show message).
    2) Before sending a message, specify a folder to store the outgoing message. This could be done via bcc in Eudora, and can be done separately in Entourage, but I don't know enough to figure out how to do it in Mail.
    Thanks for any suggestions.

    gauthier,
    1) After moving a filtered incoming message to a prescribed folder (can do this easily), open the message in a new window (or go to the folder and show message).
    You might want to take a look at the Open Message and Open Mailbox scripts available from Mail Scripts - they should do exactly what you are looking for:
    http://homepage.mac.com/aamann/
    2) Before sending a message, specify a folder to store the outgoing message. [...]
    This is not possible in Mail since you cannot hook into the sending action to perform actions before sending (and rules per se don't apply to outgoing messages). However, you might check out the Filter Sent Messages script from the above referenced Mail Scripts as somewhat of a work-around.
    Andreas

  • Applescript with Mail

    I am very new to applescript and I am having some teathing troubles.  I am trying to create a list of email addresses from emails arriving into a particular mailbox.  I think I have the logic right,
    1. Open Mail
    2. Go to the mailbox i need
    3. Go to the first message
    4. Get the email address
    5. Put the address in a text file
    6. Repeat for all the emails in the mailbox
    I'm stuck on number 2, generally how to select items i need in Mail, any help with this would be great.
    If anyone also knows of a good book that might lean towards scripting with Mail, it woud be really helpful.
    Thanks in advance!

    Hi,
    This question is probably better posted in the Mac OS X Technologies section of these forums, but here goes...
    You don't have to select anything (in the sense of clicking on it or highlighting it). But you do need to specify what you want to work on, and for that you need to read Mail's AppleScript Dictionary.
    Basically you specify the inbox of the mail account you want to work on, and then cast the senders of those messages into a list.
    tell application "Mail"
              set the_senders to sender of every message of mailbox "INBOX" of account "iCloud"
    end tell
    This may take a minute or two depending on how many messages there are in the Inbox and how powerful your Mac is.
    The senders in the resulting AppleScript list will be text strings in the form:
    "Apple Support Communities Updates <[email protected]>"
    or just the email address if the sender doesn't have a display name.
    AppleScript has fairly limited text parsing tools but you should be able to loop through the list casting these into plain email addresses and write them to a text file.
    Hope this helps!
    H

  • Ical-and mail intergration

    Is there anyway that I can get ical to pull from mail the current days emails? and display it so that I can have a daily record of the emails that I got for that day?
    Power Mac G5   Mac OS X (10.4.2)  

    Yes. It would be possible to write an applescript, and have it run at a set time each day. The script would have to get from mail all the messages in your inbox, extract for example the sender and subject, build it into a neat format, then create a new iCal event and store the list in the Notes field.
    But a few caveats ... this could quickly make iCal's files very large, and I think you would then have performance issues. You don't say whether you envisage storing the mail content in iCal; certainly I would advise against it.
    It might be better to be selective about what mails get logged this way; as you read through them , you could move the ones to be logged to a separate mailbox, and have the script scan that mailbox rather than the inbox.
    But conceptually it would be a fairlysimple task in AS.
    AK

  • Applescript for Mail Question

    Is it possible to create an Applescript for Mail, that, when an email with a specific subject line arrives in my inbox, an attached photograph would get sent immediately in response to the person who sent the email.  The subject lines would vary (e.g., people_1, or, places_16).  Every subject line would have a corresponding photo located somewhere on my hard drive (there would be hundreds of possibilities - the catalogue would be concentrated in one place).  So, for example, when "places_21" hits my Mail in box, an email would be generated in response, automatically, with a photo (places_21) attached.  Thank you!  Marcos

    Actually, it's not that hard to do, it's just that there are a lot of use cases, and a lot of caveats to consider.
    For example, do you intend/expect to work from a predefined list of image file names? Or do you want/expect to react to any filename that's requested?
    You say that the files would be 'somewhere on my hard drive'... how does the script know where to look? How does it resolve filename conflicts? What should happen if a file can't be found?
    As fane suggests, you should also consider an audit log, so you can see who asked for what, and when, along with errors that occurred on the way.
    So it's entirely do-able, just a lot of questions to answer before you get started.

  • AppleScript for mail merge

    What is AppleScript for mail merge

    AppleScript is a programming language that is tied to certain Applications that support it. Pages v5.5.1 has a scripting dictionary of the terms it will support via AppleScript. Apple's answer to not including Mail Merge functionality in Pages v5.5.1 is for individual users to roll their own, download an example and adapt it, or use another application with built-in Mail merge features.
    See my previous post to you.

  • Applescript and outlook 2011 reply email keeping original body

    Hi,
    I need help with an applescript.
    The idea is...
    I receive an email on Outlook 2011, and I can just run this applescript and it will create a response based on the original mail, with a predefined message.
    Right now it's working up to the point of creating a reply, adding the message and sending it. However, it is NOT keeping the original content of the message. that I'm replying to.
    Can someone help me with that part?
    I've tried many stuff and someone else helped me getting this one to work:
    tell application "Microsoft Outlook"
        set replyToMessage to selection
        if (replyToMessage is "") then -- nothing selected, don't continue
            log ("NOTHING SELECTED!")
            return
        end if
        set replyMessageSubj to subject of replyToMessage
        set replyMessage to reply to replyToMessage without opening window
        if has html of replyMessage then
            log ("HTML!")
            set the content of replyMessage to "<p>Working on HTML</p><br />"
        else
            log ("PLAIN TEXT!")
            set the plain text content of replyMessage to "Working on plain text"
        end if
        send replyMessage
    end tell
    Many thanks for the help.

    That's exactly what I needed to understand.
    The final one is like this in case someone else needs it:
    tell application "Microsoft Outlook"
        set replyToMessage to selection
        set mymessage to "Aqui se trapeo con jerga"
        set OldContent to content of replyToMessage
        if (replyToMessage is "") then
            log ("NOTHING SELECTED!")
            return
        end if
        set replyMessageSubj to subject of replyToMessage
        set replyMessage to reply to replyToMessage without opening window
        if has html of replyMessage then
            log ("HTML!")
            set the content of replyMessage to "Hello World<br> This is an HTML test<br><br><br><hr>" & OldContent
        else
            log ("PLAIN TEXT!")
            set the content of replyMessage to "Hello World<br> This is a plain text test <br><br><br><hr>" & OldContent
        end if
        open replyMessage
    end tell
    Many thanks for the help Llessur999!!

  • Converting report to PDF and mailing

    Hi every one,
    I've gone through various threads and i'm aware of the Functional module's used to
    convert the report to pdf and mail it back.Like CONVERT_OTFSPOOLJOB_2_PDF, CONVERT_OTF_2_PDF and for mailing we have SEND_NEW_DOCUMENT_ATT_SEND_API1.
    I've worked with this but my problem is i'm not able to convet the report output to pdf.When i'm doing this i'm getting the output of my functional module converted to pdf like the number of header and item records available for the given data in the selection screen.
    Since all the threads i've gone through is converting the single internal table which has the output to pdf.
    But i've got the REUSE_ALV_HIERSQL_LIST_DISPLAY, hierarchial report which as known has got two internal tables.How to the same to this kind of report....More over is it possible to convert report to pdf in online without transfering it to spool and getting the spool id to convert it to pdf.........
    Any help or suggestions will surely be rewarded......
    Thanks in Advance.....

    Here is the complete code for you;
    It Converts spool request into PDF document and emails it.
    <b>http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm</b>
    Regards,
    Vishal

  • App store and mail won't open. Help!

    Just cleaned my iMac with Clean My Mac and now my app store and mail wont open. Please help.

    Delete the app from the machine, boot into recovery mode, and reinstall the OS.

  • App Store and mail don't work in mavericks on a Mac Pro mid 10

    App Store and mail don't work in mavericks on a Mac Pro mid 10
    During the day more and more functions of my MacPro (mid10) are down. Icons disappear, mail pop out every time, app store doesn't even come up, wifi connection to other devices like ipad and macbook air fails.
    Any suggestion to come over this terrible upgrade?

    App Store and mail don't work in mavericks on a Mac Pro mid 10
    During the day more and more functions of my MacPro (mid10) are down. Icons disappear, mail pop out every time, app store doesn't even come up, wifi connection to other devices like ipad and macbook air fails.
    Any suggestion to come over this terrible upgrade?

  • App store and Mail app are crashing in my mac air 10.9.5

    All my apps are crashing and i am not able to open any of them . App store for Software update and Mail app, Photos app are all crashing. I have OS X 10.9.5 in my system. I removed Parallels trail version and also Clean My Mac app, Still i have the issue,Please help me to resolve the issue,

    "CleanMyMac" purports to "clean up" "junk" files. What it really does is to corrupt the operating system and many applications.   
    The first thing you need to do is remove that software according to the developer's instructions. Never install it, or anything like it, again. Then see below.
    If you don't already have a current backup, back up all data, then reinstall the OS.* You don't need to erase the startup volume, and you won't need the backup unless something goes wrong. If the system was upgraded from an older version of OS X, you may need the Apple ID and password you used.
    If you use FileVault 2, then before running the Installer you must launch Disk Utility and select the icon of the FileVault startup volume ("Macintosh HD," unless you gave it a different name.) It will be nested below another icon with the same name. Click the Unlock button in the toolbar and enter your login password when prompted. Then quit Disk Utility to be returned to the main Recovery screen.
    There are ways to back up a computer that isn't fully functional. Ask if you need guidance.
    If you installed the Java runtime distributed by Apple and still need it, you'll have to reinstall it. The same goes for Xcode. All other data will be preserved.
    *The linked support article refers to OS X 10.9 ("Mavericks"), but the procedure is the same for OS X 10.7 ("Lion") and later.

  • Help please-"Application Not Responding" for Safari and Mail

    I read in one discussion that if Safari is slow, you can go to Font Book and select the fonts with a bullet to get rid of duplicate fonts. I did that, and then decided to disable some japanese fonts I don't use.
    Now Safari and Mail don't work. Mail won't open at all, and Safari launches but doesn't load and I get the spinning wheel.
    I used Disk Utility to fix permissions, and that didn't solve the problem, and now my Disk Utility also says "Application Not Responding".
    I also went back to Font Book and enabled all the fonts I disabled. Still nothing.
    ( I can use Netscape-so it's only Mac applications I guess)
    Any help is very much appreciated.
    Thanks!
    powerpc g4   Mac OS X (10.3.2)  

    I read in one discussion that if Safari is slow, you
    can go to Font Book and select the fonts with a
    bullet to get rid of duplicate fonts. I did that, and
    then decided to disable some japanese fonts I don't
    use.
    Now Safari and Mail don't work. Mail won't open at
    all, and Safari launches but doesn't load and I get
    the spinning wheel.
    I used Disk Utility to fix permissions, and that
    didn't solve the problem, and now my Disk Utility
    also says "Application Not Responding".
    I also went back to Font Book and enabled all the
    fonts I disabled. Still nothing.
    ( I can use Netscape-so it's only Mac applications I
    guess)
    Any help is very much appreciated.
    Thanks!
    powerpc g4 Mac
    OS X (10.3.2)
    Wow- i fixed it! I remembered that when I was in Font Book originally, there were some fonts disabled, and I enabled them.
    I couldn't remember EXACTLY which ones, but I disabled some I thought were the ones, and VOILA!
    Mail works, Safari works...what a relief!
    And it only took me HOURS...oh well.
    If this might help anyone, here are the fonts I disabled again-
    BeteNoirA Regular
    BoyzRGross
    Chrome Yellow
    Coventry Garden
    FancyPants
    HardlyWorthit
    PleasinglyPlump
    RaggMoppRegular
    Anyone know if I should throw these fonts away? maybe a stupid question, but I'm not very good at this stuff and hesitate to change anything.
    powerpc g4 Mac OS X (10.3.2)

  • Need help with applescript and Xcode 4.3.2

    I'm trying to write my first application that will involve a GUI. I can code applescript using script editor with a bit of effort, but I'm want to have users input more than one piece of information in the pop up. So, I download xcode, create my first applescript cocoa project go to MainMenu.xib and add a bunch of labels, text fields and buttons. Looks fairly nice... Go to start it and... nothing (well the window pops up, but it doesn't do anything). Unfortunately, I haven't figured out how to link the window to the applescript... So, how do I...
    * Have the applescript prepopulate data in the text fields and pulldowns
    * Once the user changes the data in the fields tell the applescript
    * Tell the window to close and pass the control back to the applescript once either the cancel or submit button is pressed.
    More detailed...
    * What's an outlet and how do I use it here? Which of the 18 outlet(s) do i use for this?
    * What's a property (referenced on one of the web pages I saw around applescript and cocoa) and do I need them here?
    Looking at the documentation with xcode, there isn't a lot about xcode and applescipt. Looking at the web, the top links are a few years old. So, links to good relevent documentation would be very nice as well as direct answers to the questions
    Thanks,
    Scott

    I'm not sure why you are closing it, but the NSApplication class is what keeps track of the windows.  If you don't want to connect the window to an outlet from the interface editor, you can use something like
    set theWindow to current application's NSApplication's sharedApplication's mainWindow()
    ...and from there you can use whatever NSWindow methods, for example
    theWindow's performClose_(me)

Maybe you are looking for

  • HP PSC 1210 All-in-One Printer -- need Software (scanner directory), for windows 7 (64) bit

    hi, I am kind of done with this Printer ! lost hope in customer care and support hit with HP ! from Past 10 days searching a software to scan few doc from  my printer 1210 (HP PSC 1210 All-in-One Printer) but i dint find.... i got one from some sourc

  • How to change browser tab text?

    When I open (view) my WebHelp project, the title is not correct. It is using an "old" title from a previous project that this one was created from. I changed the title on the Properties dialog box in the actual RoboHelp project, under Project Setting

  • Urgent, Please help with new MIDI pedal

    I just got an old awesome MIDI pedal the X-15 Ultrafoot. The pedal has two expression pedals and 10 pushbuttons/pushpads (as well as two buttons to scroll through banks, and a "mode" and "bypass" button). What I want to is assign each pushbutton to a

  • SBS 2008 - SBS Console and AD errors after migration to new hardware

    Hi there, I'm trying to work out how to fix some of the errors and random behaviour I'm experiencing with the SBS 2008 console and AD related matters since I had to quickly migrate SBS 2008 to new hardware using Windows Server Backup after a failure

  • How do i uninstall safari 4 and then reinstall 3.2.1?

    after downloading safari 4 last week, i'm tired of it not letting me open hotmail. i drag safari to the recycle bin and it won't go. it isn't in use. thanks