[FIXED] AirMail open speed

I am finding the Open script for AirMail really slow to run. Is there an issue here or optimisation to be made?

Thanks for letting us know, Steve.

So far, we can’t replicate this (two of us have tried). I’m using Version 3.6.58 (546). My latest tests are with App Store version. What about yourself?

FWIW, it takes the exact same time to open a link whether it is checking 1 or 7 different email accounts, so we don’t think the number of emails or email accounts can be the issue.

Luc

We’ve added it to our investigate list will update the topic later.

1 Like

I’m also using that version, from App Store.

When getting a direct link from AirMail and clicking it, it switches to the message near instantly. Doing the exact same thing but with the Hook version of the link is taking 5 seconds.

I’ve done some work to the performance of Airmail’s Open Item script and I’m pretty proud of the improvements I’ve seen in my tests.

The new script will be in the next build of Hook, but if you’d like to try it right now you can go ahead:

set MessageID to "$0"

set MessageID to text 9 thru -1 of MessageID
set filePaths to do shell script "find ~/Library/Group\\ Containers/*.airmail/SharedData*/Accounts.plist"
tell application "System Events"
    
    set mailAccounts to {}
    repeat with filePath in every paragraph of filePaths
        try
            set itemNodes to property list items of property list file filePath
            repeat with i from 1 to number of items in itemNodes
                set itemNode to item i of itemNodes
                set mailAccount to value of property list item "mail" of itemNode
                if mailAccounts does not contain mailAccount then
                    set end of mailAccounts to mailAccount
                end if
            end repeat
        end try
    end repeat
    
    repeat with a from 1 to length of mailAccounts
        set acc to item a of mailAccounts
        open location "airmail://message?mail=" & acc & "&messageid=" & MessageID
    end repeat
    
end tell

Let me know how this compares when you get a chance to try it.

1 Like

That’s as fast as the direct link now, thanks for that @grahamb !

1 Like