Add a Keyboard Shortcut to Mail’s Load Images Button

The Load Images button in Apple Mail on Mac OS X doesn’t have a keyboard shortcut, and there’s no easy way to add one. This is very annoying. This article shows how to add one, using AppleScript and FastScripts.

I like Apple Mail for Mac OS X, but one thing that irritates me to no end is that the Load Images button (Load Remote Content in Mac OS X 10.10), which loads the images in a message on-demand, doesn’t have a keyboard shortcut. Because it’s not a menu item, there’s no easy way to add one. I looked for a way to add a keystroke to Load Images for more than five years before I finally found a way to do it.

The hard part is triggering the Load Images button itself, by anything besides a mouse click. What finally did it was using the GUI Scripting feature of AppleScript to tell the button to click itself. Once I had an AppleScript that worked, it was simple to use FastScripts to trigger the script with a keyboard shortcut.

Why don’t I let Mail load images automatically? Spammers use image loading to confirm the validity of an email address. See this Apple Support Forum post for some details, and how to turn it off.

AppleScript to Load Images in Apple Mail

Download the Load Images script v1.11, 2021-12-14

The work of the script can be done by a single line that might look like this:

click button "Load Images" of 
    UI element 1 of row 1 of table 1 of scroll area 1 of front window

(Because’s user interface has changed across various versions, and with different preference settings, the actual code is more complex. See the AppleScript for the full, ugly details.)

This user interface elements path, or specifier, tells the GUI Scripting system how to reach a specific user interface element, in this case a button, and what to do with it. It’s far from obvious how to determine one of these UI specifiers just by looking at a Mail window; I used the very interesting developer tool UI Browser to figure it out.

It’s also specific enough to be brittle; it has changed from prior versions of Apple Mail, and will probably change in the future. When it does this script will stop working and start beeping. I’ve written the script to adapt to a few different version and configuration possibilities, and I’ll try to update it if it ever breaks. The current version (v1.6) is compatible with Mac OS X 10.5 (“Tiger”) through Mac OS X 10.10 (“Yosemite”).

The rest of the script is error handling and AppleScript ceremony. It should make sense if you’re familiar with AppleScript, and there are plenty of comments, so I won’t describe it here.

Add a Keyboard Shortcut for Running the AppleScript

Adding a keyboard shortcut for an already-existing menu item is easily done using the Keyboard preference pane. Adding a keyboard shortcut for an AppleScript requires a third-party utility. You might already have a favorite–there are lots to choose from–and so do I. FastScripts from Red Sweater Software does a great job handling application-specific AppleScripts, and it’s free if you don’t need more than 10 keyboard shortcuts. (It’s also a good value at $14.95 for the unlimited version.)

Create the shortcut for the AppleScript

  1. Install and run FastScripts, and then switch to
  2. From the FastScripts menu, choose Open Mail Scripts folder.
    Open Mail Scripts folder menu item
  3. Move or copy the Load Images script into the Mail Scripts folder.
  4. From the FastScripts menu, choose Preferences…, click the Script Shortcuts tab, and add your preferred keyboard shortcut.
    Keyboard shortcut for Load Images AppleScript

Note: If you use the same keyboard shortcut I did, Command-Shift-L, you’ll need to change the keyboard shortcut for the existing menu command that uses it, by adding a new one to that command, using the technique at the Mactuts+ article linked above.

27 thoughts on “Add a Keyboard Shortcut to Mail’s Load Images Button”

  1. Well, this morning the script is loading images correctly and I haven’t changed a thing. I’m using the v1.6, 2014-12-31 script and it was toggling the flag feature with a message in the standalone viewer as well. I’m not running any mail plug-ins so I’m at a loss to explain it.

    1. I just had to restart my machine and now it’s back to toggling the flag feature. I’ll keep an eye on it and see if I can find what causes the change.

      1. I found the problem! FastScripts is no longer autoloading after the system update. Without it, Mail is defaulting to toggling the flag feature. Before posting yesterday I was looking at the script and checking the shortcuts in FastScripts so that loaded the program.

  2. Thanks for the script. I’ve been using it successfully in Yosemite until I updated to Yosemite 10.10.2. Now the script toggles the flag feature in message, classic and non-classic views. Not sure what changed.

    1. @Mike: Hmmm, that’s a new one on me! I am using Mac OS X 10.10.2 myself, and the script continues to load images just fine. Are you using any Mail plug-ins? Is this true when you open the message into a standalone window? Which version of the Load Images script are you using?

      I’m happy to try to fix the problem, but the first step in fixing is being able to reproduce it…

  3. This is really fantastic!!
    Plus I can edit my rules so that certain email pre load the content.

    However, once you view the mail and leave it…the loaded content returns to “unloaded” state.

    How can we tell Mail that we want loaded content to remain loaded/permanent state for when you want to click back to emails and web..etc!!!

    1. To my knowledge, there’s no way to make Mail do that. I’d love to be wrong, but I’ve looked. It’s just not an app that Apple is putting a lot of thought into.

  4. Hi. I bought iPod nano on your advice but did not realise that it has Bluetooth rather than wi-go. Limits it’s usefulness – cant download directly and can’t use for borrowing audiobooks from libraries. My ignorance, but please add these points to tour blog. My main intention was to use library audio and my nano is therefore useless!

  5. Let me add another big THANK YOU!! I, too, have wanted a way to load images from the keyboard for a long time.

    I had tried using this script on my old Snow Leopard system but couldn’t get it to work. I recently got a new MacBook Pro running Mavericks, and your script works great, though the first time I ran it I was prompted to go into System Preferences and change the setting in Security & Privacy > Privacy > Accessibility to allow to control my system, so you might want to add a note about that to your installation instructions. I hadn’t had FastScripts installed until now; I got it just for this purpose (though after I installed it I noticed the note from Joel pointing out that I could just have used an Automator service instead).

  6. Hi Michael,

    This Script works great for me – in Mac OS X 10.8, but not with Mac OS X 10.9 (unfortunately). I’m using Mail-Act-On and MailHub (which shows an additional button line between the window buttons and the favorite folders).

    In Mac OS X 10.8 your script works (even with MailHub enabled). Any idea to solve this?

    1. @David: Hmmm, it has to be that the UI Scripting path to the Load Images button is changed by MailHub. Interesting that it happens only on Mavericks. Off the top of my head, I don’t know what the script changes are to address this, but I would imagine it’s not too hard to change. I just need to install MailHub on my own system, and figure out the UI path to the altered location of the Load Images button. I’ll look into doing that this weekend. (Ping me if you don’t see an update within a week.)

      FWIW, I’m using Mac OS X 10.9 (“Mavericks”) myself, with Mail Act-On, Mail FollowUp, Attachment Tamer, QuoteFix, and the plugins for MsgFiler and SpamSieve, and it’s been working just fine for me. So, it’s only going to be the UI-altering plugins that cause issues. I don’t know that I can support every possibility here, but perhaps I can provide instructions for folks who choose to use tools I don’t myself.

  7. This is great! I copied the script into an automator Service with no input for Mail and was able to assign my shortcut there without having to use a third-party app.

    1. @Joel: That’s a neat way to add a keystroke, thanks for mentioning it! There’s lots of different ways that should work, the tricky thing is the AppleScript part. Use whatever works best in your setup. Cheers!

  8. Hi, thank you for providing the script. Unfortunatly it’s not working on my MBP (with 10.8 latest and its I used it as provided from the Script-Menubar and also exchanged “Load images” to “Bilder laden” due to my systemwide language settings (German). But none version worked, I didn’t event get any alarm or beep.

    Any idea what went wrong? Thank you and happy new year!

    1. @Sascha: Hmmm. It sounds like it’s almost certainly an internationalization problem, which I just won’t have any idea how to deal with. I just don’t have access to machines to test on. The only thing I can suggest is making sure that, when you change the text in the script (a) change it every place it occurs (I count at least seven instances of that string; I just revised the script to make this easier), and (b) make sure the text string matches the button text exactly, including capitalization. So, if you changed the script to look for a button with the text “Bilder laden” but the actual text is “Bilder Laden” (capitalized “L”), it won’t work. Verify the text is the same.

      I don’t know if either of these will help, but let me know if it does, and I’ll publish the updated script.

  9. Just wanted to add my thanks to your very helpful instructions. Just finished getting it installed and working and LOVE the shortcut to loading images. Can’t believe Apple won’t simplify things like this. I love their products but wonder sometimes at their feature designers…

    1. @Erik: Hmmm. Yes, I’m sure you can accomplish this, with the right amount of experimentation and tenacity. From the look of the scripts posted at that URL, it will take a bit of both!

      But, do you need it to all come from one keyboard shortcut? Would it be OK to press Command-P to open the print dialog, and then another keyboard shortcut (Control-Option-A?) to choose to save it as a PDF to the ACTION PDF option? If that’s OK, you can accomplish that without bothering with scripting. Just add a keyboard shortcut to your PDF workflow, using the instructions in the article Keyboard Shortcut for “Save as PDF…” in OS X at MacSparky.

      I just tested it on Mac OS X 10.8 (Mountain Lion), and it worked fine for my Save to Yojimbo workflow.

      Keyboard shortcut for PDF Workflow

      The same trick should work for any PDF workflow, and this will give you the ability to easily have multiple workflows that you give shortcuts to, instead of having to write many scripts that will probably be fragile…

      1. Print to PDF is a piece of cake. At least it has been up to and including Mt lion. All you need to do is add a keyboard shortcut in Preferences. Command-P works fine. It seems that once the print dialog is open Command-P becomes an available shortcut. All I do is press and hold the Command key and then press the P key twice, and I am taken immediately to the Save As PDF dialog.

        This shortcut works great as I use this several times a day every day in Safari and my girlfriend uses it in all applications with regularity.

        It is worth noting that every two or three weeks Safari gets confused and Command-P quits working for the Print dialog. A restart of Safari is all that is need to get things going again.

        1. @Tripp: What a great tip! I didn’t know that Command-P gets freed up when the Print dialog opens. What a great time-saver for printing to PDF. I think this one is so good, I’ll write it up as a full post! (If you’ve written it up somewhere else, let me know, and I’ll just link there instead. Credit where credit is due.)

  10. Thank you. I wouldn’t have thought of using GUI scripting. Previously I had a script blindly clicking in the right location. But when I upgrade to Mac OS X 10.8.3 it broke. Unfortunately your solution didn’t work out of the box right away. So I download UI Browser and found that the following worked in Apple Mail 6.3 with the message select on the side and not the top:

    click button “Load Images” of UI element 1 of row 1 of table 1 of scroll area 1 of splitter group 2 of splitter group 1 of window 1

    So yeah, very brittle.

    1. Wow, fabulous, so the script not only needs to care which version of Mac OS X (and thus it’s running on, but also the layout of the window. Great to know, and maddening to learn that Mail is such a PITA. I’ve been working on an updated version of the script that can handle multiple versions of Mail, and @JohnWaers’s idea of using the try several times seems like a good approach. Look for an update some time during or after the Memorial Day holiday weekend.

  11. THANK YOU! This issue has frustrated me for years, and failing in my own AppleScript attempts, I’d resorted to many fruitless suggestions to Apple via their feedback page. Google searches led nowhere until today, when I found your May 6 post at in response to the “Stupid Question™…” with a link to your blog.

    Your script works great for an open Mail message but not for messages displayed in a mailbox window. The following modified script works for both cases.

    tell application "System Events"
        tell process "Mail"
            if not (window 1 exists) then return beep 1
            try -- message displayed in a mailbox window
                click button "Load Images" of UI element 1 of row 1 of table 1 of scroll area 1 of splitter group 2 of splitter group 1 of window 1
            end try
            try -- message displayed in a separate mail window
                click button "Load Images" of UI element 1 of row 1 of table 1 of scroll area 1 of window 1
            end try
        end tell
    end tell
    1. This is great to know, thanks for posting! At first I didn’t get what your problem was, but I forget that not everyone turns back the UI in Mail to 1999 like I do. Of course my UI reference wouldn’t work if you’re using the preview pane or, as @DavidHorne pointed out, if you’re using the new Mail layout. I’ve been working on an updated version of the script to handle multiple versions of Mail, and it should be possible to also handle multiple layouts in the same way. Look for an updated version of this script some time during or after the Memorial Day holiday weekend. Thanks!

Comments are closed.