Applescript for Mail Simple Problem

I am a professor, and I am looking to write several simple scripts for Apple's Mail client.  These scripts all involve replying to students (vs. replying to colleagues, or others).
The first script I am looking for would create a new blank message and set the signature of that message to a predefined sig called "Teaching".
What I have so far is:
tell application "Mail"
    activate
    set theMsg to make new outgoing message with properties {visible:true}
    set message signature of theMsg to "Teaching"
end tell
This script hangs at "activate", resulting in a timeout error (why???).  If I delete the activate command, the new message is created, and then Mail times out.
Any suggestions appreciated.
Warmly,
Professor E

Hi,
You must specify the signature like this :
set message signature of theMsg to signature "Teaching"

Similar Messages

  • I loaded Mac OS X v10.7 Lion yesterday. Everything's running fine, except for a simple problem. Any time I want to copy a file, JPEG, etc., I am prompted "Finder wants to make changes. Type your password to allow this." I don't want this!! Is there a way

    I loaded Mac OS X v10.7 Lion yesterday. Everything’s running fine, except for a simple problem. Any time I want to copy a file, JPEG, etc., I am prompted “Finder wants to make changes. Type your password to allow this.” I don’t want this!! Is there a way to unlock “Finder” or rid this process?

    Back up all data.
    This procedure will unlock all your user files (not system files) and reset their ownership and access-control lists to the default. If you've set special values for those attributes on any of your files, they will be reverted. In that case, either stop here, or be prepared to recreate the settings if necessary. Do so only after verifying that those settings didn't cause the problem. If none of this is meaningful to you, you don't need to worry about it.
    Step 1
    If you have more than one user account, and the one in question is not an administrator account, then temporarily promote it to administrator status in the Users & Groups preference pane. You can demote it back to standard status when this step has been completed.
    Triple-click the following line to select it. Copy the selected text to the Clipboard (command-C):
    sudo chflags -R nouchg,nouappnd ~ $TMPDIR.. ; sudo chown -R $UID:20 ~ $_ ; chmod -R -N ~ $_ 2> /dev/null
    Launch the Terminal application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Terminal in the icon grid.
    Paste into the Terminal window (command-V). You'll be prompted for your login password, which won't be displayed when you type it. You may get a one-time warning not to screw up. If you don’t have a login password, you’ll need to set one before you can run the command.
    The command will take a noticeable amount of time to run. Wait for a new line ending in a dollar sign (“$”) to appear, then quit Terminal.
    Step 2
    Boot into Recovery by holding down the key combination command-R at startup. Release the keys when you see a gray screen with a spinning dial.
    When the OS X Utilities screen appears, select
    Utilities ▹ Terminal
    from the menu bar. A Terminal window will open.
    In the Terminal window, type this:
    resetpassword
    That's one word, all lower case, with no spaces. Then press return. A Reset Password window will open. You’re not going to reset a password.
    Select your boot volume ("Macintosh HD," unless you gave it a different name) if not already selected.
    Select your username from the menu labeled Select the user account if not already selected.
    Under Reset Home Directory Permissions and ACLs, click the Reset button.
    Select
     ▹ Restart
    from the menu bar.

  • 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.

  • Pls i need help for this simple problem. i appreciate if somebody would share thier ideas..

    pls i need help for this simple problem of my palm os zire 72. pls share your ideas with me.... i tried to connect my palm os zire72 in my  desktop computer using my usb cable but i can't see it in my computer.. my palm has no problem and it works well. the only problem is that, my  desktop computer can't find my palm when i tried to connect it using usb cable. is thier any certain driver or installer needed for it so that i can view my files in my palm using the computer. where i can download its driver? is there somebody can help me for this problem? just email me pls at [email protected] i really accept any suggestions for this problem. thanks for your help...

    If you are using Windows Vista go to All Programs/Palm and click on the folder and select Hot Sync Manager and then try to sync with the USB cable. If you are using the Windows XP go to Start/Programs/Palm/Hot Sync Manager and then try to sync. If you don’t have the palm folder at all on your PC you have to install it. Here is the link http://kb.palm.com/wps/portal/kb/common/article/33219_en.html that version 4.2.1 will be working for your device Zire 72.

  • Applescript for mail error can't get message id

    I have an applescript (found on internet) for Mail 4.5 that deletes messages in "on my mac" mailbox "Deleted Inbox" that are older than 120 days. The script runs from an iCal daily event. I drag messages from Inbox to "Deleted Inbox" when I don't want the message in Inbox, but I want to save the message for 120 days before deleting it. The script sometimes runs successfully, and sometimes gives error "Mail got an error: Can't get message id xxx of mailbox "Deleted Inbox"". Then in Mail, I "Mailbox / Rebuild" that mailbox, and run the script manually without error. How can I avoid that error? The script is essentially:
    tell application "Mail"
              set OldStuff to every message of mailbox TheBox where date received of it < OldDate
              repeat with ThisMessage in OldStuff
        delete ThisMessage
              end repeat
    end tell
    Thanks for any help.
    Ken

    How can I avoid that error?
    I don't actually know how you can avoid that error. However, maybe you can use a workaround and have the script rebuild the mailboxes automatically when such an error occurs. Try the following code:
    tell application "Mail"
      try
        set OldStuff to every message of mailbox TheBox where date received of it < OldDate
      on error
        activate
        tell application "System Events" to click menu item "Rebuild" of menu 1 of menu bar item "Mailbox" of menu bar 1 of process "Mail"
        delay 1 -- adjust if necessary
        set OldStuff to every message of mailbox TheBox where date received of it < OldDate
      end try
      repeat with ThisMessage in OldStuff
        delete ThisMessage
      end repeat
    end tell
    Since the above script uses GUI Scripting, you must enable the Accessibility Frameworks by clicking the checkbox labeled "Enable access for assistive devices" in the Universal Access System Preference pane.
    Message was edited by: Pierre L.

  • Writing an AppleScript for Mail

    I have never written an AppleScript before, so I don't know if this is even possible. But, here goes...
    I manually process my junk mail by opening each message, clicking on "Long Headers," and forwarding to [email protected] Is it possible to write a script that would allow this process to be automated?
    Thanks.

    You can get the header text with this Applescript:
    Click here to launch Script Editor.
    tell application "Mail"
    the selection
    properties of item 1 of the result
    set thisHeader to all headers of the result
    end tell
    There is a sample Applescript included with Mail.app called "Create New Message.scpt", it should contain snippets to get you going.
    Or Google and there will be plenty of simpler ones. Truth be told, the Apple sample scripts are about the worst for learning from.

  • Applescript for mail.app won't send attachment

    I have an applescript to send a mail attachment but the mail sends without the attachment? Anyone know why?
    set theContent to (current date) as string
    set theSubject to "excel file"
    set theTarget to "someone @someplace.com"
    set theSender to "admin"
    set theName to "some name"
    set theAttachment to "mcp0_HD:Users:bill:Site:logs:deviceLogs.xls"
    tell application "Mail"
    set newMessage to make new outgoing message with properties {subject:theSubject, content:theContent & return & return}
    tell newMessage
    make new to recipient at end of to recipients with properties {visible:true, name:theName, address:theTarget}
    set sender to theSender
    tell content
    make new attachment with properties {file name:theAttachment} at after the last paragraph
    send newMessage
    end tell
    end tell
    end tell

    If you are still having problems, then there is something wrong with your file that you are trying to attach, or your declaration of this variable:
    set theAttachment to "mcp0_HD:Users:bill:Site:logs:deviceLogs.xls"
    Examine that very carefully. It is also a good idea to use the *path to* nomenclature (see the Dictionary for *+Standard Additions+* for more details) to access a file in cases like these. For example, here is the pertinent portion of a script that I have used since the Panther days to do precisely what you are trying to do:
    set pay_Path to ((path to documents folder as text) & "Cathouse:Payroll:Paysheets:Today.xls")
    tell application "Mail"
    set b to make new outgoing message with properties {sender:"[email protected]", subject:("Payroll")}
    set content of b to "Hello:
    Here is the payroll ending today: " & return & return
    tell b's content
    make new attachment with properties {file name:pay_Path as alias} at after the last paragraph
    end tell
    tell b to make new to recipient with properties {address:"[email protected]"}
    send b
    end tell
    I use this every other week to report my payroll to my accountant. It has never failed, and I am using Leopard (10.5.7).
    Good luck,

  • Export mail message as PDF Applescript for mail rules

    I have looked everywhere for this and found nothing. I don't have 40 hours to learn applescript myself but from the little I do know this should be possible. Probably easy.
    I want to created an applescript to run as a mail rule. I want the script to export the message as a PDF and move that PDF to a specified folder. Hazel can take it from there.
    for instance:
    Fedex sends me a email message that my shipment has been delivered.
    mail rule kicks in and runs the script
    script creates a PDF of the message
    message is moved to "fedex delivered" folder

    I found a workaround, though there must be something neater.
    I added this before my script
    tell application "System Events"
              tell process "Mail"
                        tell menu bar 1
                                  tell menu bar item "View"
                                            tell menu "View"
                                                      tell menu item "Sort By"
                                                                tell menu "Sort By"
                                                                          click menu item "Subject"
                                                                end tell
                                                      end tell
                                            end tell
                                  end tell
                        end tell
              end tell
    end tell
    then the same except "Date" instead of "Subject".
    My script does what i want now.

  • Applescript for mail rule

    I found this on Mactech. All I did was add the line "make new outgoing........", well, it does NOT work. What do you have to do to make Mail trigger an applescript. All I want to do is when I an email reminder, to just make a new email message with Happy Birthday in the Subject. I'll click the stationary and add a birthday background. Any help would be appreciated.
    using terms from application "Mail"
    on perform mail action with messages theSelectedMessages for rule theRule
    repeat with a from 1 to count theSelectedMessages
    make new outgoing message with properties {visible:true, subject:"Happy Birthday", content:"Happy Birthday "}
    end repeat
    end perform mail action with messages
    end using terms from

    sorry but your suggestion did NOT work. Here is what I wrote and it did NOT make a difference the script will NOT generate an outgoing message.
    using terms from application "Mail"
    on perform mail action with messages newMessages
    repeat with newMessage in newMessages
    tell application "Mail"
    set senderName to (extract name from sender of newMessage)
    say "You've just received an email from " & senderName
    say (subject of newMessage) as string
    if (subject of newMessage) contains "birthday" then
    tell application "Mail"
    activate
    make new outgoing message with properties {visible:true, subject:"Happy Birthday", content:"Happy Birthday "}
    end tell
    end if
    end tell
    end repeat
    What I was able to do was embed a line of code to call another script that does successfully create an out going message. Here is the successful script.
    using terms from application "Mail"
    on perform mail action with messages newMessages
    repeat with newMessage in newMessages
    tell application "Mail"
    set senderName to (extract name from sender of newMessage)
    say "You've just received an email from " & senderName
    say (subject of newMessage) as string
    end tell
    end repeat
    tell application "Finder"
    open "Macintosh HD:Users:Shawn:Documents:Applescripts:Mail scripts:make outgoing email happy birthday5.app"
    end tell
    end perform mail action with messages
    end using terms from
    here is the make birthday5 app
    tell application "Mail"
    activate
    make new outgoing message with properties {visible:true, subject:"Happy Birthday", content:"Happy Birthday "}
    end tell
    Now when I get my birthday reminder, according to the "Rule" set up in preferences, if the subject contains "birthday" the script will read the name and subject and generate an outgoing message with Happy Birthday in the Subject and Body.....all I have to do is add some birthday stationary, type in a sappy line and viola, done. See why I love Macs so much.

  • AppleScript for Mail

    Is it possible to make an applescript that will check for unread messages through the whole mailbox, then tell me how many there are, then say who each unread mail is from. Ask me to have it read the subject then open, mark as read, or leave for later?

    just like to add in my script based on the above
    i've been looking for something similar to this for a while and tried allsorts of snipets from many of the posts so heres my attempt
    this actually uses the mailbox or folder that is selected in mail.app so you dont have to explicitly tell it which folder you want to use (had that part of the code from another post somewhere so credit to them not me
    display alert "Please note!" message "This script may take a while if you have a lot of mailboxes selected. Do you want to continue?" buttons {"Cancel", "Yes"} cancel button "Cancel"
    tell application "Mail"
              tell front message viewer
                        set theSelectedMailboxes to selected mailboxes
                        repeat with a from 1 to length of theSelectedMailboxes
                                  set theCurrentMailbox to item a of theSelectedMailboxes
      processMailbox(theCurrentMailbox) of me
                        end repeat
              end tell
    end tell
    on processMailbox(theMailbox)
              tell application "Mail"
                        set unread_messages to (messages of theMailbox whose read status is false)
                        set unread_count to count unread_messages
      --display dialog "Total unread messages: " & unread_count
                        repeat with each_message in unread_messages
                                  set the_subject to subject of each_message
                                  set the_sender to sender of each_message
                                  set the_action to choose from list {"Open", "Mark as read", "Keep for later", "Delete"} default items {} with prompt "Subject: " & the_subject & return & return & "Sender: " & the_sender & return & return & "What do you want to do with this message?" & return with title "Unread message" without multiple selections allowed
                                  if the_action is false then return
                                  if item 1 of the_action is "Open" then open each_message
                                  if item 1 of the_action is "Mark as read" then set read status of each_message to true
                                  if item 1 of the_action is "Delete" then
                                            set read status of each_message to true
                                            set junk mail status of each_message to true
                                  end if
                        end repeat
              end tell
              tell application "AppleScript Editor"
      activate
                        display dialog "Do you want to delete the email?" buttons {"yes", "no"} default button 2
                        if result = {button returned:"yes"} then
                                  tell application "Mail"
      # deletes every message that is Read and marked as Junk.
      # Any that are not read AND junk will remain.
                                            delete (every message of theMailbox whose junk mail status is true and read status is true)
                                  end tell
                        else
                                  if result = {button returned:"no"} then
                                  end if
                        end if
              end tell
    end processMailbox

  • AppleScript for mail merge with Excel data?

    Is there any approach for an AppleScript that lets you use Excel data as source for some kind of mail merge operations? If not, would anyone here be interested if someone (I?) would take a closer look at some kind of a (AppleScript Studio) solution for this?

    I'm not sure I get the question.
    If it is "could you use AppleScript to create mail merge for Pages with Excel?", the answer is, Yes. Both Pages and Excel are scriptable.
    If the question is "has anyone done it yet?", I don't know, but it could be a fun exercise.
    If the question is "would there be a market, if someone (you?) wrote and released such a script?", I cannot tell, but personally I would probably write a hack that worked only for my own needs - if I had them. The overhead with usability, testing, different address formats, languages, different Excel sheet formats, and so on, makes me guess that the investment wouldn't pay off for a generic solution. Especially considering both Pages and MS Office already have their own mail merge functions.

  • Applescript for mail to speak 'sent to'

    Hey, I use 6 mail accounts in mac mail, 4 of which are work addresses. I get a lot of mail to my 2 personal addresses which is low priority but i would like to setup speech to say the 'sent to' address when mail arrives. my computer screen is on sleep a lot of the time so if a mail arrives to a high-priority work address I would wake my screen to read immediately. Does anyone know of a script that would speak the mailbox/sent to name? thanks guys, dren.

    --- Code starts here ---
    using terms from application "Mail"
    on perform mail action with messages tMessages
    tell application "Mail"
    repeat with tMessage in tMessages
    say "Sent to " & (name of account of mailbox of tMessage)
    end repeat
    end tell
    end perform mail action with messages
    end using terms from
    --- Code ends here ---
    In 'Mail' 'Preferences' -
    01. Create a new rule.
    02. Leave the first popup button set to 'any', and select 'Every Message' from second popup button.
    03. Under 'Perform the following actions:', select 'Run AppleScript' from the only popup button.
    04. Click on the respective popup button's 'Choose...' button and navigate to where the above code is saved (as an AppleScript script file).

  • Running LB10 to create TO from TR for replenishment simple problem....

    Hello -
    We run LB10 to create TO's from TR's for replenishment.
    If we have the following stock situation:
    Material A
    TR quantity:  300
    Available stock in Potential source bin A:  150
    Available stock in potential source bin B:  150
    When you create this TO in background, it find the first 150 and then stops and leaves the remaining 150 on a partially filled TR even though there is another 150 in the same storage type that is available for pick.  It picks one quant, and then stops and doesnt try to find more quants in the same storage type to pick.
    How can I get it to create a second line on the TO with the additional qty from this second bin?  Is it config?  User exit?  I know they could do this in foreground processing, but that is time consuming and not ideal.
    Any help would be greatly appreciated.
    THANKS

    what is your picking strategy?
    If you do it in foreground, please describe what extra steps you need to perform manually.

  • Applescript for Mail 2.x

    Hi,
    Does anyone have a script that will save the attachments (from a folder called Requisition in Mail) in a folder located on the desktop? Have been trying but to no avail!
    Thanks and appreciate any help in this matter.

    set source_Folder to "Requisition" -- Name of source folder.
    set destination_Folder to "From Requisition" -- Name of destination folder.
    try -- Optional code, to ensure existance of 'destination_Folder'
    tell application "Finder" to make new folder at (path to desktop folder from user domain) with properties {name:destination_Folder}
    end try
    -- Code to move contents from 'source_Folder' to 'destination_Folder'.
    tell application "Finder" to move items of folder (((path to library folder from user domain) as string) & "Mail:" & source_Folder) to folder (((path to desktop folder from user domain) as string) & destination_Folder)
    ... or, hard-coded as, ...
    try -- Optional code, to ensure existance of 'destination_Folder'
    tell application "Finder" to make new folder at (path to desktop folder from user domain) with properties {name:"From Requisition"}
    end try
    -- Code to move contents from 'source_Folder' to 'destination_Folder'.
    tell application "Finder" to move items of folder (((path to library folder from user domain) as string) & "Mail:Requisition") to folder (((path to desktop folder from user domain) as string) & "From Requisition")
    ... Or, if a sub-set of files of 'Requisition' is desired, ...
    set source_Folder to "Requisition" -- Name of source folder.
    set destination_Folder to "From Requisition" -- Name of destination folder.
    set sourceFolderPath to (((path to library folder from user domain) as string) & "Mail:" & source_Folder & ":")
    try -- Optional code, to ensure existance of 'destination_Folder'
    tell application "Finder" to make new folder at (path to desktop folder from user domain) with properties {name:destination_Folder}
    end try
    try
    set tList to list folder sourceFolderPath without invisibles -- Obtain list of 'source_Folder's contents.
    -- Present 'tList' in 'choose from list' window, and accept single or multiples selections, or the 'Cancel' action.
    set selected_Files to choose from list tList with prompt "select File(s):" with multiple selections allowed without empty selection allowed
    repeat with i in selected_Files -- Cycle through the selected files.
    -- Move selected files from 'source_Folder' to 'destination_Folder'.
    tell application "Finder" to move file ((sourceFolderPath & i) as alias) to folder (((path to desktop folder from user domain) as string) & destination_Folder)
    end repeat
    end try
      Mac OS X (10.4.4)  

Maybe you are looking for

  • Adobe Photoshop CS6 Purchasing Info?

    I have had Adobe Photoshop CS6 free trial, and now it is asking if I want to get the full version. But, it is asking for a serial code, and I do not know where I can buy Adobe CS6 or buy a serial code. All I can find is Adobe Photoshop CC or other ve

  • How to find newly updated rows in a table

    Hi.. How to know newly updated rows in a table. Thanks in advance pal

  • How to configure N+1 HA

    Hi,, everyone... My messaging server version is as follow... root@idm02/users/leeky/mail6.3/sbin>./imsimta version Sun Java(tm) System Messaging Server 6.3-8.01 (built Dec 16 2008; 32bit) libimta.so 6.3-8.01 (built 17:17:19, Dec 16 2008; 32bit) SunOS

  • Under "CLIP" all featured options are grade out. Please Help!!! Also the blade and blade all are not shown in the tool bar...

    Hello People. I just reinstalled my sound track pro which took me forever, dah . And now I'm having difficulties with using some options that are listed under the  "Clip" they simply all grade out. Also some tools such as blade and blade all are not

  • How to Compile this prog. i DOS prompt.

    Hey Friends, I don't know how to compile this prog. on DOS prompt, kindly tell. // My Java Prog. package package1; import java.awt.Graphics; import java.lang.Number; import java.io.*; import java.net.*; import java.util.*; import java.awt.Color; impo