Insert Image Into Body Of Gmail Message

Every two weeks, I create the body of similar Gmail reminder messages shown below where the text is pasted using a KM macro and I manually paste the image (created by an Excel VBA) from the Clipboard History Switcher. I have searched the forum unsuccessfully for a solution to get the image into the body of the Gmail message using KM or an AppleScript. Have I just missed it or Is it not possible?

Hey @KM_Panther,

Maybe not impossible, but damn difficult (IF it can be done).

If it can be done it would be a combination of AppleScript and JavaScript, or a Execute a JavaScript in Safari (or Chrome) action.



Yeah, I guess I can believe it since it appeared that a number of other forum members were looking for something similar, but their threads never quite got to asking the question and no suggestions were offered.

I now seem to have difficulties to even manually paste the image into my Chrome Gmail message from the Clipboard History Switcher! I’ve called IT to see if something had changed.

So, I’m trying to use an approach Peter showed by first saving the image in a Named Clipboard and then writing the image to a .PNG file. I’m using the upload icon using the Click At Found Image action.

Its not sophisticated, but here's a straight-forward test macro that I have working using the Click At Found Image actions.

Keyboard Maestro “Paste Clipboard & Personnel Assessment Reminder Email Test” Macro

Paste Clipboard & Personnel Assessment Reminder Email Test.kmmacros (68 KB)

1 Like

I think it may be about saving the file to disk and setting that path to a variable.
In that fashion, you could then, within the gmail compose window, depending on where you ‘left off’ , you could tab to the ‘insert photo’ icon, click enter, the open dialog window would be active, you could then use the Command+Shift+G key to ‘Go To the File’, paste the path variable in there and be good, - I think, just takin a stab.

As cool as it would be to do this with Keyboard Maestro alone, there’s a Gmail Lab out there that will do most of the work. It’s called “Canned Responses”.

  1. Install the Gmail lab:

  2. Write an email containing only your content that doesn’t change.

  3. Save it as a canned response (i.e. a template).

  4. Write a macro to insert a particular canned response, probably with images of the button and text to navigate through the canned responses menu.

  5. Trigger your macro and you’re good to go.

I tested this with an image in the template and can confirm that it works.

troy & kraftyDevil,

I agree and I am grateful for Peter's post that provided the idea to have a macro write the clipboard to a file and then click the 'insert photo' icon to paste the image and click the remaining necessary items on the screens to finish off the message. I modified my MS Excel VBA to trigger a different macro to save the system clipboard to named clipboards and write the named clipboards to files which the macro shown here inserts into the messages. As I post this, I suppose I could modify this macro to also save the clipboard files.

I did install the Gmail lab. However, I decided to simply use the KM macro to handle the entire job since a number of parts of the message does change.

Thank you both!

Keyboard Maestro “Personnel Assessment Reminder Email” Macro