[FIXED] AirMail open speed

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