How can I open mail.app on iMac with applescript?

Hello

I will build and run a script to open the mail on my iMac application and apply the rules I created Apple. This is to get rid of the spam and junk at the launch of the mail application.

I tried the 'recording' function, but nothing happens! The script remains empty. So I do not right. Not very well know how it works.

Thanks for your help

Hi mac_naashenaas. To open the mail and bring it to the front with an AppleScript script, you can simply use:

activate the application "Mail".

Or you can use explicitly a statement to say:

Tell application "Mail" to activate

You can also use the creator code of the app Finder and Mail file:

Tell application "Finder" to open the application file id "emal".

Or use Finder and Mail bundle identifier:

Tell application "Finder" to open the application file id "com.apple.mail.

You can also run a shell command to open a mail:

shell script ('open - a \"Mail\'")

Another option is to display a dialog box with user input:

appName text returned value ("what application you want to open?" response by default 'Mail' dialogue display)

activate the appName application

You can also search for Mail to choose in the Applications folder with a command prompt:

appName choose application with guest the value "choose an application to open:

activate appName

Finally, another option is to display a dialog box with buttons:

display dialog 'which application you want to open?' the default button buttons {'email', 'Browse', 'Cancel'} "Mail".

If result = {return button: "Mail"} then

activate the application "Mail".

otherwise if result = {return button: 'Browse'} then

appName choose application with guest the value "choose an application to open:

activate appName

end if

Further reading:

http://macosxautomation.com/AppleScript/firsttutorial/index.html

Introduction to AppleScript Language Guide

Tags: Mac OS & System Software

Similar Questions

  • How can I open files GTC I took with my camera. Do I need to download a program or what?

    Original title: GTC files

    How can I open files GTC I took with my camera. Do I need to download a program or what?

    According to this (http://www.fileinfo.com/extension/ctg), they are not intended to be opened by users, but to be used internally by the camera. You should have another copy of the image on the camera, in a different format (JPG, PNG, RAW, etc.).

    --

    Dustin Harper
    E-mail address is removed from the privacy *.
    http://www.mstechpages.com  Microsoft News, support, FAQ, and much more!

    "mdwsport" wrote in message News: 7f93fe4f-986-b-410-935-cd744eed7e81...

    How can I open files GTC I took with my camera. Do I need to download a program or what?

    Dustin Harper * address email is removed from the privacy * http://www.mstechpages.com---aide Windows and Support Page

  • How can I open the files of CD with a red exclamation point, I don't know what to do 'Association Set'

    I have a CD full of records, but they all have a red exclamation point and I can't open them. He said "they do not have an associated program to perform this action" and that I must create an association?

    Hello

    • What type of data is stored in the CD?
    • What version of Windows operating system do you use?

    I suggest you send the screenshot of the data that was stored in the CD.

    http://answers.Microsoft.com/en-us/Windows/Forum/Windows_7-security/how-do-i-post-a-screen-shot-on-this-forum/c86de820-C620-401c-A804-9f6337cd3053

  • How can I open mail received yesterday?

    help with e-mail

    Hello

    1. do you mean that you got a file attached to your email zip? If so, so what exactly happens when you try to download the attachment? You get the error message?
    2. which webmail client or email you use?

    Please answer these questions and tell us more about the issue. This could help us help you better.

    Why can't I view an attachment in Windows Mail?
    http://Windows.Microsoft.com/en-us/Windows-Vista/why-cant-I-view-an-attachment-in-Windows-Mail

    Compress and uncompress files (zip files)
    http://Windows.Microsoft.com/en-us/Windows-Vista/compress-and-uncompress-files-ZIP-files

    Working with Windows Mail in Windows Vista
    http://Windows.Microsoft.com/en-us/Windows-Vista/working-with-Windows-Mail

  • How can I open a disk external flash with el capitan?

    I use a 13-inch MacBook Air (mid-2011), speed of the Intel Core processor i5 at 1.7 GHz, memory 4 GB 1333 MHz DDR3, memory Flash 121, OS X El Capitan Version 10.11.1.

    I'm trying to save documents on and also to retrieve some documents in my FlashDrive but devices since I installed El Capitan a few days ago, it was impossible, please tell us how this can be done. Thank you very much.

    Try to describe in detail what you have tried and what does not.

  • How can I open a PhotoShop CS6 download with a .7z file extension

    Download, installation, commissioning downloaded Photoshop CS6 of adobe and now he asks me how I want to open the file and gives me different options such as the store, paint, etc windows photo viewer?

    You need two files. One with a .exe extension and the other with the extension of .7z.

    Then you double-click on the .exe file and follow the prompts.

  • How can I install LR4 upgrade on iMac with OSX Mt Lion?

    Bought updates, to CS6 CS5 and LR3 to LR4. AkaMi Download Manager has been paired with CS6 download. Clicked on Download Manager and no problem with CS6 download and installation. LR4 had not a download Akami Manager click on or on the alternate download method. Only option is to click on download. Files download but cannot open on my computer.

    Lightroom 4 does not use a download manager for downloading.  If you encounter a problem launching the download then I recommend trying another web browser.  This is probably due to put security, add-on, or installed the plug-in.

  • I can't open my apps because she asked to renew my subscription, but I already have.

    How can I open my apps when it is not let me because it is asked to renew the subscription I already have?

    In the same pop that invites to renew the subscription, look the option named "have a different Adobe ID", click it and then get into Adobe ID and password and check again.

    Always the same?

    Disconnection of Adobe Creative Cloud app and sign in only once and check:

    Connect and disconnect activate Cloud Creative applications

  • The first time to open Mail.app: opens the window Import Mail Message - crashes during the infinite-import cycle how to break it?

    El Captain 10.11.03

    .. 10.11.03 .after install, I leave el capitan migrate my old yosemite data.

    restart: when opening mail.app mail insists in the import of 'old' e-mail accounts of the

    standard window "import mail message.

    When importing, it breaks down. How to curb this "never-ending cycle" and of 'just' open mail without importation of message and let me

    everything by myself: accounts and import the 'old' one by one.

    This way I can also identify the import data that causes the accident and so on...

    Is there a file to delete that stop the routine of "import of message window?

    This crash report help? :

    Process: Mail [890]

    Path: /Applications/Mail.app/Contents/MacOS/Mail

    ID: com.apple.mail

    Version: 9.2 (3112)

    Generation information: Mail-3112000000000000 ~ 7

    Code type: X 86-64 (Native)

    Parent process:? [1]

    Manager: Mail [890]

    User ID: 501

    Date/time: 2016-03-09 23:16:00.867 + 0100

    OS version: Mac OS X 10.11.3 (15 d 21)

    Report Version: 11

    Anonymous UUID: BD98511C-1892-5044-70F8-62C35E853145

    Sleep/wake UUID: B53BF3CA-4CDB-4B18-BC26-CBCE4AFEE019

    Time since started awake: 4700 seconds

    Wake time: 1700 seconds

    Integrity of system protection: enabled

    Crashed thread: queue 2-[LibraryImportAssistant synchronouslyDoTheImport] hurry: NSOperationQueue 0x7f8d2615c3e0: NSOperation 0x7f8d2617f2b0 (QOS: UTILITY)

    Specific application Backtrace 1:

    0 CoreFoundation 0x00007fff946e8ae2 __exceptionPreprocess + 178

    1 libobjc. A.dylib 0x00007fff81590f7e objc_exception_throw + 48

    2 CoreFoundation 0x00007fff94589840 _CFXNotificationGetTaskCenter + 0

    3 MailCore 0x00007fff8ee1c21b-[MCMimePart (SMIMEDecodingInternal) _verifySignatureWithCMSDecoder:againstSender:signingError:] + 2941

    4 MailCore 0x00007fff8ee1a01e-[MCMimePart (SMIMEDecoding) decodeApplicationPkcs7_mimeWithContext:] + 4554

    5 MailCore 0x00007fff8edf3b36-[MCMimePart decodeWithContext:] + 411

    6 MailCore 0x00007fff8edee5d5-[MCMimePart decodedContentWithContext:] + 91

    7 MailCore 0x00007fff8edf42ae-[MCMimePart decodeMultipartWithContext:] + 140

    8 MailCore 0x00007fff8edf3b36-[MCMimePart decodeWithContext:] + 411

    9 MailCore 0x00007fff8edeedec-[MCMimePart parsedMessageWithContext:] + 95

    MailCore 10 0x00007fff8eddb40e-[MCMimeBody parsedMessageWithContext:] + 179

    11 MailCore 0x00007fff8edc08a7-[MCMessage searchableItemWithHTML:includingText:] + 2693

    12 email 0x00007fff96f14cff-[MFRecoveredMessage searchableItemWithHTML:includingText:] + 118

    13 mail 0x00007fff96f12b87 + [MFRecoveredMessage searchableItemForBodyData:plistData:path:persistentID:] + 335

    14 mail 0x00007fff96e04a08 __247 + [MFLibrary insertOrUpdateMessages:withMailbox:fetchBodies:isInitialImport:isMailboxRebuild: oldMessagesByNewMessage:remoteIDs:newDocumentIDs:setFlags:clearFlags:messageFla gsForMessages:copyFiles:progressDelegate:updateRowIDs:missedMessages:error:] _blo ck_invoke1168 + 18627

    15 mail 0x00007fff96e27e61 + [MFLibrary executeBlock:isWriter:useTransaction:isPrivileged:] + 766

    16 mail 0x00007fff96dff36b + [MFLibrary insertOrUpdateMessages:withMailbox:fetchBodies:isInitialImport:isMailboxRebuild: oldMessagesByNewMessage:remoteIDs:newDocumentIDs:setFlags:clearFlags:messageFla gsForMessages:copyFiles:progressDelegate:updateRowIDs:missedMessages:error:] + 6167

    17 mail 0x00007fff96e081cd + [MFLibrary addMessages:withMailbox:fetchBodies:isInitialImport:oldMessagesByNewMessage:rem oteIDs:setFlags:clearFlags:messageFlagsForMessages:copyFiles:missedMessages:erro a:] + 263

    18 mail 0x00007fff96e21ad1 + [MFLibrary importMailbox:] + 1640

    19 e-mail 0x00007fff96e24093 __46 + [MFLibrary importMessagesFromEnabledAccounts] _block_invoke2500 + 701

    20 mail 0x00007fff96e28469 + [MFLibrary executeBlock:isWriter:useTransaction:isPrivileged:] + 2310

    21 mail 0x00007fff96e230f7 + [MFLibrary importMessagesFromEnabledAccounts] + 4057

    22 mail 0x0000000109a431f3 + 1757683

    23 CoreFoundation 0x00007fff945b317c __invoking___ + 140

    24 CoreFoundation 0x00007fff945b2fce-[French invoke] + 286

    25 MailCore 0x00007fff8edf9036-[MCMonitoredInvocation invoke] + 245

    26 MailCore 0x00007fff8ee2b98e-[major MCThrowingInvocationOperation] + 48

    27 MailCore 0x00007fff8edb4cde-[major _MCInvocationOperation] + 426

    28 the 0x00007fff918c72fb Foundation-[__NSOperationInternal _start:] + 654

    29 0x00007fff918c6de7 __NSOQSchedule_f + 194 Foundation

    30 libdispatch.dylib 0x00007fff8617c33f _dispatch_client_callout + 8

    31 libdispatch.dylib 0x00007fff86180f6f _dispatch_queue_drain + 754

    32 libdispatch.dylib 0x00007fff8618763b _dispatch_queue_invoke + 549

    33 libdispatch.dylib 0x00007fff8617fc87 _dispatch_root_queue_drain + 538

    34 0x00007fff8617fa34 _dispatch_worker_thread3 + 91 libdispatch.dylib

    35 libsystem_pthread.dylib 0x00007fff961d568f _pthread_wqthread + 1129

    36 libsystem_pthread.dylib 0x00007fff961d3365 start_wqthread + 13

    Summary of the external change:

    Calls made by other processes for this process:

    task_for_pid: 2

    thread_create: 0

    thread_set_state: 0

    Calls made by this process:

    task_for_pid: 0

    thread_create: 0

    thread_set_state: 0

    Calls made by all processes on this machine:

    task_for_pid: 2405

    thread_create: 0

    thread_set_state: 0

    Summary region VM:

    ReadOnly part of libraries: Total = 325.4 M resident = 0 K (0%) swapped_out_or_unallocated=325.4M(100%)

    Regions in writing: Total = 376.5 M written = 0 K (0%) resident = 0 K (0%) swapped_out = 0 K (0%) unallocated=376.5M(100%)

    VIRTUAL REGION

    The NUMBER of DIMENSIONS of TYPE REGION (not melted)

    ===========                     =======  =======

    Accelerate.Framework 256K 3

    2048K 2 follow-up activity

    CG backup stores 5080K 4

    CG image 260 K 5

    CG shared images 240K 6

    CoreAnimation 168K 15

    CoreUI 1928 K 14 image data

    CoreUI image file 224K 5

    Ship 8192 K 2 continuations

    The Foundation 25.8 M 297

    Image IO 4096 K 2

    Kernel Alloc once 8 K 3

    MALLOC 282,9 258 M

    MALLOC 32K 7 cover page

    Tag memory 242 12K 2

    Memory 12 251 K 2 tag

    OpenCL                               8K        2

    Corpse process Info 2048 K 2

    SQLite page cache 15.2 M 106

    BATTERY GUARD 56.0 M 13

    The stack of 13.1 M 15

    VM_ALLOCATE 68K 10

    __DATA 36.3 M 349

    __IMAGE 528K 2

    __LINKEDIT 91.5 M 19

    __TEXT 233.9 356 M

    __UNICODE 552K 2

    mapped file 53.0 M 17

    16.3 shared memory M 10

    ===========                     =======  =======

    TOTAL 849,1 M 1501

    Exception type: EXC_CRASH (SIGABRT)

    Exception codes: 0 x 0000000000000000, 0 x 0000000000000000

    Note the exception: EXC_CORPSE_NOTIFY

    Request for clarification:

    "Reason for terminating app due to exception while now the database lock 'NSInvalidArgumentException',: ' *-[__NSArrayM insertObject:atIndex:]: object cannot be null"

    Abort() called

    You have locally stored messages slot "on my Mac"?

    You have IMAP or POP accounts?

    How much free space on your drive? Use disk utility to find this info.

    I wrote two articles that might help you. If you have the opportunity to start again in the Yosemite, you can export data, as explained before moving on to the post of El Capitan. If this is not possible, you can always ignore the upgrade process by importing your data. Let me know if you have any questions.

    Troubleshooting Apple Mail in OS X 10.11 El Capitan

    Capitan http://www.needhelp4mac.com/2015/10/Troubleshooting-Apple-Mail-in-OS-x-10-11-El-/

    Before moving to the post of El Capitan

    http://www.needhelp4mac.com/2015/11/before-upgrading-to-El-Capitan-mail/

    (Fair disclosure: Needhelp4Mac is my site.) I can receive some form of compensation, financial or otherwise, of the links on my site.)

  • How can I open an attachment winmail.dat on my imac?

    How can I open an attachment winmail.dat of my emails?

    Winmail.dat - TNEF's enough

    Mac OS X Mail - what is a winmail.dat attachment?

  • My mail has been locked; How can I open it?

    Separated from this thread.

    Customers who publish "Me Too" on answered discussions usually don't get tracked. [snip]

    my mail has lock, how can I open it

    my mail has lock, how can I open it

    What mail service?

    If Hotmail or outlook.com, go to http://windows.microsoft.com/en-US/windows-live/id-support and select "why is my account temporarily blocked?

    Don

  • I can't open winmail.dat (13.9 KB) which is attached to an AOL e-mail. I have Windows XP Home Edition. How can I open this file?

    I can't open winmail.dat (13.9 KB) which is attached to an AOL e-mail.  I have Windows XP Home Edition.  How can I open this file?

    original title: winmail.dat

    Try using Winmail.dat Reader

  • How can I open Windows Live Mail?

    How can I open Windows Live Mail?

    Hi ElizabethHorvath,

    The question you have posted is better suited to the support of Windows Live Mail. I recommend you ask your question to the Windows Live Mail support for assistance.

    Hope the helps of information.

  • I backed up on an external hard drive of PS4 and cannot open it on my iMac with OS 10.8.5. He says to reinstall, but the only version is on my external hard drive. How can I transfer it to my iMac?

    I backed up on an external hard drive of PS4 and cannot open it on my iMac with OS 10.8.5. He says to reinstall, but the only version is on my external hard drive. How can I transfer it to my iMac?

    Hi aliceag,

    You can please download Photoshop CS4 from the following link and install it

    Link: other downloads

    Kind regards

    Tanuj

  • How can I open a fixing ppt recvd in an e-mail?

    Nothing offered by browsing will open it. How can I open this attachment type?

    It's a presentation PowerPoint from Microsoft.

    Microsoft offers a PowerPoint Viewer and free office and openoffice.org opened the file format as well.

Maybe you are looking for

  • Time machine always fails after a day or two

    It is so incredibly boring, I can't understand what is happening. I have an of UDB external HARD drive that I use for time machine. All the time after a day or two of the race, he's going to say "time machine could not backup"Backup"" when I click on

  • I have no sound on my Satellite PRO L20

    Hello I ve had a my Satellite PRO L20 (PSL25E 00K007EN) a while now and I ve had no noise. I was looking everywhere.I tried this thread... http://forums.computers.toshiba-europe.com/forums/thread.jspa?threadID=15804 and downloaded the driver that has

  • Satellite L500-19 x crashes when loading dvd software

    Satellite L500-19 x crashes when loading dvd software. It's photoshop elements 9. Other software by load generally okay, but not always. Any ideas?

  • Cannot install the update to windows. Error 66A and 643

    Original title: update What to do? the computer tells me to update I'm going through windows Updater runs and after a minute error 66 has 643 error happens and no updates, what can do to solve this problem?

  • IKEv2 VPN without using licensed SSL? (ASA-5512)

    Hi all I enabled Cisco 'Anyconnect Premium peers' for customer less connections vpn ssl, the obvious snag is that for Anyconnect ikev2 sessions he wants to use the SSL license pool instead of the IPSEC pool (which I have a lot of connection for 'peer