How to run custom AppleScript in the background at all times?
In my opinion, the best way to do it is by using Apple's own task scheduler: launchd, because you don't need to install third-party software. First, the theory: to run a script from the command line, you just run: 

osascript /PATH/TO/YOUR/script.scpt


Knowing this, all you have to do is create a plist file in ~/Library/LaunchAgents/ with this:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
    &lt;key&gt;Label&lt;/key&gt;
    &lt;string&gt;air-mail-beta.job&lt;/string&gt;
    &lt;key&gt;ProgramArguments&lt;/key&gt;
    &lt;array&gt;
        &lt;string&gt;/usr/bin/osascript&lt;/string&gt;
        &lt;string&gt;/PATH/TO/YOUR/SCRIPT&lt;/string&gt;
    &lt;/array&gt;
    &lt;key&gt;RunAtLoad&lt;/key&gt;
    &lt;true/&gt;
&lt;/dict&gt;
&lt;/plist&gt;


The name of the plist file doesn't matter, but it should be in ~/Library/LaunchAgents/. Also, make sure to change /PATH/TO/YOUR/SCRIPT accordingly.

Finally, you just need to tell launchd that you want this script to always run. To do that, you just do: 

launchctl load -w ~/Library/LaunchAgents/NAME-OF-YOUR-PLIST.plist


and you're done! If it looks like the script didn't start, you can do this: 

 launchctl start air-mail-beta.job


where air-mail-beta.job is the property under &lt;key&gt;label&lt;/key&gt; that we've set in the plist file.

Finally, should you ever need to disable the script, don't forget to unload it with: 

launchctl unload -w ~/Library/LaunchAgents/NAME-OF-YOUR-PLIST.plist


I know this solution is more technical, but trust me, that's a better way to deal with your issue. If you have any question, just ask!