Load Once on MailMate - Selective Image Blocking

UPDATE (Please Use Below as Reference for UI Scripting): https://heesoo.org/2019/04/10/much-improved-load.html

One feature that I miss using OS X Mail.app was being able to Load Image using Keyboard Maestro app as AppleScript trigger. This allows me to selectively only load remote image on emails that I want to load and be tracked. Thanks to UI Browser app to poke around the MailMate UI, I got following code to work:

https://gist.github.com/heesoo/2cfdf55045c1d8d235576865f507bb89

– version 2018-04-20_01
– by https://heesoo.org
tell application “System Events”
    tell process “MailMate”
        – For View Layout Thread Arcs, Three Panes & Widescreen
        try
            set loadImagesButtonRef to a reference to button “Load Once” of group 2 of splitter group 1 of splitter group 1 of window 1
        end try
        – Case for Search was activated (by clicking or by search box)
        if not (loadImagesButtonRef exists) then
            try
                set loadImagesButtonRef to a reference to button “Load Once” of group 4 of splitter group 1 of splitter group 1 of window 1
            end try
        end if
                if not (loadImagesButtonRef exists) then return beep 1
                – Click “Load Once”
        click loadImagesButtonRef
    end tell
end tell

Keyboard Maestro MailMate Load Once

heesoo.org @heesoo