Mail Apple Script

I need to Apple Script so mail closes at login and doesn't stay open. I lost it somehow. Anyone have it?

To hide Mail when it is open:
tell application "System Events"
set visible of process "Mail" to false
end tell
To quit Mail:
tell application "Mail"
quit
end tell
A delay statement, such as 'delay 2', can be placed at the beginning of each script if the event is being triggered too fast. In any case, put the script text into the Script Editor in the /Applications/AppleScript/ folder, save it as an application, and add the script to the list of login items for your account in the Accounts pane of System Preferences.
(20280)

Similar Messages

  • Apple Script: Incoming Mail - bigger Text with Rule

    Salve!
    Have some Problems to create an Apple Script. At first - some Mail Accounts from Incoming Mails in Apple Mail App (Mountain Lion) are very fine with Font Size. Some Mail looks like Font Size 6 in the Inbox. Ok, i can size the Font higher with CMD and + ... but it is manual... i dont like this workaround.
    So i create an new Rule in Mail App - Incoming Mail from XYZ and then start this Apple Script XYZ...
    But i am an beginer with Apple Script and it will not work. Can you please help me? I will start the Script with Apple Rule. And the Script must formated the new incomming Mail with Font Size 12 (or 14... or... Number is only one Number)...
    Can you help me please?

    Launch Applications > Utilities > Terminal.app and see if the undocumented defaults setting defaults write com.apple.mail MinimumHTMLFontSize 12 (that's mentioned here) works for you.  That example sets the minimum font size to 12.  You might need to restart mail after the change; I haven't used this setting in a while.

  • Apple script for Message box when Mail app Compose Window Opens

    Hi there
    I'm trying to make mail app remind me to choose the right emaill address to send from since I have several email addresses. Is there a way I can make or write an apple script for a message box to pop up whenever mail app's compose window opens up.
    I can do for the case when I actally click the compose button when I'm on mail app by using UI scripting. But when it comes to hyperlinks which opens up the compose window, it fails.
    I just want a script to see whether the compose window is open and if open pop up a message box.
    Thanks
    Best regards
    Zam Shabeer Thahir

    TaoChitpol wrote:
    By the way, the problem happens with the account of MS Exchange service, I don't know if this is the cause of the problem.
    I think yes.  The encoding is being corrupted somewhere, probably Exchange.  There is nothing you can change on the iPad other than the OS languagel, to see if that helps.  You can also tell Apple at
    http://www.apple.com/feedback/

  • An apple script that saves mail attachments no longer works in lion

    In my mail rules, I have been using an apple script, which, if the sender belongs to a certain group, saves any attached files to a special folder I have for attachments from that group. After installing Lion, It performs other parts of my rule (plays a sound, for instance and moves the mesage to a special mailbox, for another), but it FAILS now to save the attachment using the script below. I hope someone knows of a workaround. If not, I hope apple will fix this soon. Here's the script--
    using terms from application "Mail"
        on perform mail action with messages theMessages for rule theRule
            tell application "Mail"
                repeat with oneMessage in theMessages
                    set {mail attachment:theAttachments} to oneMessage
                    repeat with oneAttachment in mail attachments of oneMessage
                        save oneAttachment in ("i828:Users:i8:Desktop:Poker Player:PPlayattach2") & (name of oneAttachment)
                    end repeat
                end repeat
            end tell
        end perform mail action with messages
    end using terms from

    This worked brilliantly!
    Thanks
    David

  • How do I install and apple script in mail

    I am using  dreamhost as my ISP. I am  getting killed with spam and the have a  script. I found out how to add  the script via the rules function, but,  how do you store the script in  the location you need to retreive it  from. there I can't find info. Can  someone give me steps please? Do you  make a text file, etc?

    Select Mail Help from Mail's Help menu. Search for "install apple script."
    Use scripts as rule actions
    You can attach a script to a Mail rule. For example, you could have an incoming message trigger a script that copies information from the message and pastes it into a database that works with AppleScript.
    Open Mail
    Choose Mail > Preferences, then click Rules.
    Add a rule or select an existing rule to edit.
    Choose Run AppleScript from the “Perform the following actions” pop-up menu.
    Choose a script from the pop-up menu of scripts that are located in ~/Library/Application Scripts/com.apple.mail. Or choose “Open in Finder” to open the folder so you can copy a script into it.If you later move or rename the script, your rule will not work.
    Click OK to save the rule.
    If you used scripts in Mail rules in OS X Lion or earlier, then the first time you open Mail in OS X Mountain Lion or later, your scripts are moved to ~/Library/Application Scripts/com.apple.mail, and your rules are updated with the new location. To show your home Library folder, hold down the Option key, then in Finder choose Go > Library.
    If you use iCloud Documents & Data, your rules are available on your other Mac computers (with OS X 10.8 or later) that have iCloud Documents & Data turned on. Scripts attached to rules aren’t available.

  • Apple Script For Opening External EML File With Apple Mail

    Hi folks,
    

 I am working with Apple Script for implementing numerous function related to Mail App.
    

I am using the following Apple Script lines for opening the mails which are in Mail app for each modes.
    

View Mode : open theMsg

    Reply View Mode : reply theMsg opening window yes

    Reply All Mode : reply theMsg opening window yes reply to all yes

    Forward Mode : forward theMsg opening window yes



    I want to know how we can open external eml file in different view modes (View, Reply, Reply All and Forward) using Apple Script or Apple Event programmatically with a similar mechanism available through script in Mail App.

    
Thanks in advance.

Regards
    
Nisar

    I'm not sure what you're doing here, but this isn't anything I recognize as compilable applescript. what is this 'mode' thing you're talking about.
    at any rate, if you have a loose emlx file sitting around somewhere you can simply open it in mail (use the 'open' command and the file specification for the emlx file) and work with it appropriately. if you're talking about an actual eml file (e.g. from Outlook Express) you'd have to GUI script Mail's 'import mailbox' command (the applescript handler for importing mail only works with Mail.app mailboxes)

  • Apple Script Solution to Mail problem

    I'm very new to Mail, but was wondering if anyone with some script experience could tell me if an Apple Script could help with this problem: http://discussions.apple.com/thread.jspa?threadID=742249&tstart=0
    I appreciate any help in advance!

    Answered elsewhere

  • Getting apple mail account online/offline status through apple script

    Please let me know,If anyone have idea of getting apple mail account online / offline status through apple script.

    mohammed jasum k p wrote:
    Otherwise how to get the online/offline status value.If u can please give me a solution for this.
    this is not possible by any means I know. not every problem has a solution, sorry.

  • Sending email using apple script...

    I have created a watch folder using apple script that when a file is dropped on it, it automatically opens, formats, and sends out a custom email.
    What I don't understand is, how can I include multiple variables in the "content" section (also known as the body section of the email)? I want to put custom type in the content section that says "There is a file awaiting your review." I also would like to choose an email signature from my mail program to use. Third, I would like to include the name of the file that is being sent....
    I found that by doing {content:iteminfo} I could get the file name...If I do {content:"There is a file awaiting your review."} I could get the custom type I wanted....
    BUT, I can't figure out how to get BOTH of them together in ADDITION to adding a custom email signature...
    I know there are some really smart people out there...Any tips?

    I can't figure out how to get BOTH of them together
    This is just standard AppleScript text concatenation with the &:
    ... {content: "There is a file awaiting your review: " & iteminfo}
    Here you can see I'm concatenating a literal string (enclosed in quotes) and a variable. You can extend this ad infinitum.
    As for the signature:
    tell theMessage to set message signature to signature "My Sig"
    (which assumes you have a signature named 'My Sig'. Adjust as necessary.

  • Can Apple Script or Automator handle large client email tasks?

    Hi,
    I am a relatively new Mac user but currently work on a MacBook and Imac G5 with 10.4.9. I have a client list of approxamitely 900 people and I want to send an email to all 900 announcing a change in product services. Is there an Apple Script or automator script (or somewhere I could go to purchase one) that will allow me to import my name and email list in .csv or excel format and then send a slightly customized email to all. I just want the subject line and greeting to the email to include their first name so it looks as if I have taken the time to send them a personal email.
    Can anyone steer me in the right direction. Thanks in advance!

    Hi,
    Here's a script to disable a rule" --> tell application "Mail" to set enabled of rule "weekend message" to false
    Change "weekend message" by the exact name of your rule.
    Make an (iCal Events or Launch agent PLIST or cron) to run the script on Monday at a specific time.

  • Selecting Different Printer With Apple Script.

    Hi,
    I am currently in the process of making a script to be able to print off labels without the need of much user input (read from a document or e-mail) and I want to be able to set the printer when it goes to the print screen.
    this is the final apple script step in the application cmd+p brings up the 1st print menu the return takes it to the second print menu cmd+v pastes predifind by the user the ammount of copys they want
    on run {input, parameters}
              tell application "Labels & Addresses"
      activate
                        tell application "System Events"
      keystroke "p" using command down
                                  delay 1
      keystroke return
                                  delay 1
      keystroke "v" using command down
                                  delay 1
                                  tell application "System Events"
                                            tell process "Labels & Addresses"
                                                      click (menu item whose description is "Printer")
                                                      click (menu item "Zebra Technologies ZTC GK420t" whose description is "Printer")
                                            end tell
                                  end tell
                                  return input
                        end tell
              end tell
    end run
    now there is chance to change the printer selection twice once in the 1st print screen and once in the 2nd print screen the only problem is im not sure how to apple script to select the right printer from the drop down menu, I got the code from a forum but I think it was old code as when I tested it it was returning errors so I modified it a bit and now it just struggles finding the menu item with description of printer.
    Does anyone know what I would have to use for it to select the right printer? (The Zebra Technologies ZTC GK420t)
    Help would be greatly appricited!
    Thanks,
    Bruce
    P.S. sorry the code is a bit messy!

    Im NOT sure if you have just made this a little over complicated… This works just fine for me. Tested with about a dozen psd layers…
    tell application "Adobe InDesign CS2"
    tell active document
    tell rectangle 1
    tell graphic 1
    tell graphic layer options
    set GLC to count of graphic layers
    repeat with i from 1 to GLC
    if name of graphic layer i ≠ "Blue" then
    set current visibility of graphic layer i to false
    else
    set current visibility of graphic layer i to true
    end if
    end repeat
    end tell
    end tell
    end tell
    end tell
    end tell
    This variant also works as I would have expected too… Retaining visibility from a list…
    tell application "Adobe InDesign CS2"
    tell active document
    tell rectangle 1
    tell graphic 1
    tell graphic layer options
    set On_List to {"Red", "Aqua", "Orange"}
    set GLC to count of graphic layers
    repeat with i from 1 to GLC
    if name of graphic layer i is not in On_List then
    set current visibility of graphic layer i to false
    else
    set current visibility of graphic layer i to true
    end if
    end repeat
    end tell
    end tell
    end tell
    end tell
    end tell

  • Email Scheduler Now Works! (Apple Script!)

    Hey everyone,
    For all wondering how to schedule emails ahead of time to go out, the programmer has updated the "Schedule Delivery" Apple Script and it now works. I tried this 2 years ago and it was a pain after 10.5 as it was very buggy. But now it's up and running!
    Mail Scripts - 2.9.1
    Workflow-enhancing AppleScripts for Mail & Address Book
    http://www.versiontracker.com/dyn/moreinfo/macosx/16217

    thanks a lot for the info. this ability is often requested. MailScripts was the only tool to offer it but it didn't work in leopard. of course, Apple really ought to have this functionality built in...

  • Removing BCC with Apple Script when automatically BCC myself is set in pref

    I have "Automatically Bcc myself" set in the Mail Composing preferences, which I like because I get a copy of email that I send. I also have an apple script that forwards messages to an email address. When I used this apple script on Tiger, the BCC option was never added (it might have been a bug with Mail in Tiger); however, now on Leopard, the BCC option is always added when I used the apple script.
    I've tried setting the BCC field to Null and Blank, but that doesn't seem to work. I suspect that the field is set upon send or the "make new" directive. Does anyone know a way to tell Mail to not Bcc automatically in an Apple Script?
    Here is the forward apple script program:
    (* Cf. http://www.macosxhints.com/article.php?story=20060219014940761 *)
    (* RS 31st July 2006 *)
    set theAuthority to "person AT here"
    tell application "Mail"
    set theMessages to the selection
    repeat with thisMessage in theMessages
    set newMessage to make new outgoing message at end of outgoing messages
    tell newMessage
    set visible to true (* comment out whole line to stop 'blinking' windows *)
    set content to thisMessage's source
    set subject to "Fwd: " & thisMessage's subject
    set bcc to null (* my attempt to set bcc to null or blank *)
    make new to recipient with properties {address:theAuthority}
    end tell
    send newMessage
    set read status of thisMessage to true
    set was forwarded of thisMessage to true
    set junk mail status of thisMessage to true
    end repeat
    end tell

    Thanks for that reply!
    After more google searching, I found this on http://www.macosxhints.com/article.php?story=20040425063255443
    One of the responses said that you can add the lines:
    delete bcc recipients
    delete cc recipients
    "in that order" to the new message tell and get rid of the recipients. I had tried the delete before, but I thought I had to get the recipients before I deleted them. I'm not a very good apple script person. Here is my final script
    (* Cf. http://www.macosxhints.com/article.php?story=20060219014940761 *)
    (* RS 31st July 2006 *)
    set theAuthority to "email address here"
    (* or your personal Knujon address *)
    tell application "Mail"
    set theMessages to the selection
    repeat with thisMessage in theMessages
    set newMessage to make new outgoing message at end of outgoing messages
    tell newMessage
    set visible to false (* comment out whole line to stop 'blinking' windows *)
    set content to thisMessage's source
    set subject to "Fwd: " & thisMessage's subject
    make new to recipient with properties {address:theAuthority}
    delete bcc recipients
    delete cc recipients
    end tell
    send newMessage
    set read status of thisMessage to true
    set was forwarded of thisMessage to true
    set junk mail status of thisMessage to true
    end repeat
    end tell

  • Help Needed with Apple Script

    I need a little help with Apple Script. I have been using a script for several months now, and all of a sudden it just stopped working. Here's the script"
    ============
    with timeout of 9999 seconds
    tell application "Finder"
    activate
    (* copy target file to another disk - to create a backup *)
    duplicate file "Daily.dmg" of folder "File Backups" of disk "HD Mirror" to folder "Data Backup-Daily" of disk "MacHD 1" replacing yes
    (* copy a 2nd target file to another disk - to create a backup *)
    duplicate file "Personal.dmg" of folder "File Backups" of disk "HD Mirror" to folder "Data Backup-Daily" of disk "MacHD 1" replacing yes
    (* now copy the 2nd target file to my iDisk *)
    duplicate file "Personal.dmg" of folder "Data Backup-Daily" of disk "MacHD 1" to folder "Documents" of disk "xxxxxx" replacing yes
    end tell
    end timeout
    ============
    In the above script, xxxxxx represents the name of my iDisk that is mounted in the Finder.
    Here's my issue - the above script worked fine until just recently. However, now the first two steps work fine, but I get this error message while trying to copy the file to my iDisk:
    "The operation could not be completed because some items had to be skipped. 'Personal.dmg'"
    Does anyone have any ideas on how I can fix this? I'm wondering if Mac OS 10.4.5 might be the culprit since this problem seems to have occurred shortly after I upgraded???
    Thanks,
    -AstraPoint

    Hi,
    Assumptions :-
    uuencode command exits
    mailx command exits
    File name is "vas.txt".
    Mail id is "[email protected]"
    # START OF SCRIPT
    #!/bin/ksh
    vasFileName="$1"
    vasRecordsDirFile=/etl/dev/work/wellness/enrl_rej/records/${vasFileName}
    vasMetatdataDirFile=/etl/dev/work/wellness/enrl_rej/metadata/${vasFileName}
    vasHeaderDirFile=/etl/dev/work/wellness/enrl_rej/header/${vasFileName}
    vasHeaderRejDirFile=/etl/dev/work/wellness/enrl_rej/hdrrej/${vasFileName}
    vasFieldsDirFile=/etl/dev/work/wellness/enrl_rej/fields/${vasFileName}
    if [[ -e ${vasRecordsDirFile} ]]
    then
    uuencode ${vasRecordsDirFile} ${vasRecordsDirFile} | mailx -s "process complete and attached are the rejected records" [email protected]
    elif [[ -e ${vasMetatdataDirFile} ]]
    then
    uuencode ${vasMetatdataDirFile} ${vasMetatdataDirFile} | mailx -s "Metadata Mismatch no of fields in detail didn't match" [email protected]
    elif [[ -e ${vasHeaderDirFile} ]]
    then
    uuencode ${vasHeaderDirFile} ${vasHeaderDirFile} | mailx -s "Problem with header file - File Rejected" [email protected]
    elif [[ -e ${vasHeaderRejDirFile} ]]
    then
    uuencode ${vasHeaderRejDirFile} ${vasHeaderRejDirFile} | mailx -s "the Percentage of rejects more than 3 percent File rejected" [email protected]
    elif [[ -e ${vasFieldsDirFile} ]]
    then
    uuencode ${vasFieldsDirFile} ${vasFieldsDirFile} | mailx -s "The header and detail count didn't match File rejected" [email protected]
    else
    echo "File doesn't exist in any of the directories mentioned."
    fi
    # END
    Vijay Bheemineni.

  • I need help writing an apple script

    earlier I made an application with automater saying that when it opens it would add something to my todo list, for example, the subject being english and priority being very high. Then I made an apple script telling it to open the application I made. Then I made a mail rule telling it that if i text my computer and the text includes english and very important (english is subject and very important is the priority) it would open the apple script that tells the application i made to open and put english in my todo list. Can someone tell me how I can make a script in which it puts whatever I text my computer in my todo list, so if i text my computer anything random it would put it in my todo list

    Well after a bit of head scratching I have done it! And it was simpler than I expected although I'm sure the script can be improved, it does what I want it to do. Any suggestions on improvements would be welcome.
    Andy E
    The script...
    set artistName to text returned of (display dialog “Enter artists name:” default answer “”)
    set artistSortName to text returned of (display dialog “Enter artists sort name:” default answer “”)
    if artistName is “” then
    set tempVer to display dialog “No artist name specified!” buttons {“OK”}
    return
    end if
    if artistSortName is “” then
    set tempVer to display dialog “No artist sort name specified!” buttons {“OK”}
    return
    end if
    tell application “iTunes”
    activate
    set theLibrary to library playlist “Library”
    set searchList to search theLibrary for artistName
    repeat with thisTrack in searchList
    set thisArtist to artist of thisTrack
    if thisArtist is equal to artistName then
    set sort artist of thisTrack to artistSortName
    end if
    end repeat
    end tell
    15" MacBook Pro 2.16GHz, 2GB Ram   Mac OS X (10.4.10)   It's my first Mac and I love it!

Maybe you are looking for

  • First Record is repeated twice in main window of script

    Dear All, I am developing a Script form, which contains 3 windows Header,Main and Footer. My Problem is that in Main window the first record is repeated twice and the remaining all records are ok. I am unable to solve this issue of stopping the dupli

  • Drag and drop issues 10.7.2 Mac OS X .. what do I do?

    Drag and Drop ain't working ... 2,3 Ghz Intel Core i5

  • Too high cpu load with HP 6510b

    Hello guys, I have a very high cpu load on my laptop even if nothing despite htop is running. I guess it's a problem with acpi because when I deactivate acpi completely over the bootline I have no such problems. How could I fix that? Thank you in adv

  • The program does not run

    Hello! I have a MacBook and a XCode installed ( latest version from App World for Mac ), but when I write a programm and click "Run", I have an empty window without the text. What's the problem. I tried more code examples.

  • How do you have ichat conversations in gmail?

    Just wondering if there is a way to do it.  Thanks!