# \[FIXED\] AirMail open speed

**URL:** <https://discourse.hookproductivity.com/t/fixed-airmail-open-speed/420>\
**Category:** Bug Reports\
**Created:** [May 3, 2019, 2:43pm UTC](https://discourse.hookproductivity.com/t/fixed-airmail-open-speed/420 "2019-05-03T14:43:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![stevelw](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/s/ea666f/32.png) [@stevelw](https://discourse.hookproductivity.com/u/stevelw)\
**Post date:** [May 3, 2019, 2:43pm UTC](https://discourse.hookproductivity.com/t/fixed-airmail-open-speed/420/1 "2019-05-03T14:43:15Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![LucB](https://discourse.hookproductivity.com/user_avatar/discourse.hookproductivity.com/lucb/32/2228_2.png) [@LucB](https://discourse.hookproductivity.com/u/LucB)\
**Post date:** [May 3, 2019, 11:21pm UTC](https://discourse.hookproductivity.com/t/fixed-airmail-open-speed/420/2 "2019-05-03T23:21:19Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![LucB](https://discourse.hookproductivity.com/user_avatar/discourse.hookproductivity.com/lucb/32/2228_2.png) [@LucB](https://discourse.hookproductivity.com/u/LucB)\
**Post date:** [May 3, 2019, 11:42pm UTC](https://discourse.hookproductivity.com/t/fixed-airmail-open-speed/420/3 "2019-05-03T23:42:08Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stevelw](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/s/ea666f/32.png) [@stevelw](https://discourse.hookproductivity.com/u/stevelw)\
**Post date:** [May 7, 2019, 8:38am UTC](https://discourse.hookproductivity.com/t/fixed-airmail-open-speed/420/4 "2019-05-07T08:38:47Z")

</div>

> [@LucB](#):
>
> I’m using Version 3.6.58 (546). My latest tests are with App Store version. What about yourself?

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.

---

<div class="post-metadata">

**Author:** ![grahamb](https://discourse.hookproductivity.com/user_avatar/discourse.hookproductivity.com/grahamb/32/369_2.png) [@grahamb](https://discourse.hookproductivity.com/u/grahamb)\
**Post date:** [May 11, 2019, 3:15am UTC](https://discourse.hookproductivity.com/t/fixed-airmail-open-speed/420/5 "2019-05-11T03:15:07Z")

</div>

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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![stevelw](https://discourse.hookproductivity.com/letter_avatar_proxy/v4/letter/s/ea666f/32.png) [@stevelw](https://discourse.hookproductivity.com/u/stevelw)\
**Post date:** [May 12, 2019, 5:48pm UTC](https://discourse.hookproductivity.com/t/fixed-airmail-open-speed/420/6 "2019-05-12T17:48:52Z")

</div>

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