# MsgFiler Filing Script

By default, MsgFiler 4 can perform many actions on Mail, such as opening mailboxes, creating new mailboxes, flagging and labeling messages, and more. If you do not have any Gmail accounts, MsgFiler 4 can also file messages without any help. It does this by communicating with Apple Mail using AppleScript.

{% hint style="warning" %}
It's strongly recommended to install and activate the MsgFiler Filing Script even if you don't have a Gmail account. It brings all the performance and features from previous versions of MsgFiler back to MsgFiler 4 running o n macOS Sonoma!
{% endhint %}

If you have Gmail accounts, however, MsgFiler 4 needs to perform some extra steps to make sure your emails are filed properly. And unfortunately, MsgFiler 4 cannot perform these steps due to restrictions on apps by the App Sandbox (see [Why a Separate Script?](https://docs.msgfiler.com/using-msgfiler/msgfiler-filing-script/why-a-separate-script)) and Mac App Store. By installing the MsgFiler Filing Script in MsgFiler 4's dedicated Application Scripts folder, MsgFiler 4 can now send these extra commands to Mail to enable the following:

* filing messages to Gmail accounts
* selecting the next/previous message after filing to non-Gmail accounts
* archiving messages from MsgFiler 4
* shortcut actions

{% hint style="info" %}
To learn more about the history behind the MsgFiler Filing Script, [click here](https://docs.msgfiler.com/using-msgfiler/msgfiler-filing-script/why-a-separate-script).
{% endhint %}

## Installation

Installation of the MsgFiler Filing Script is covered in the [Filing Script](https://docs.msgfiler.com/onboarding/filing-script) section of "Onboarding."

The **MsgFiler Filing.scpt** file will be placed in the following location on your computer:

`~/Library/Application Scripts/com.atow.MsgFiler4`

Scripts run by MsgFiler 4 from this folder are allowed to do so outside of the App Sandbox. Commands for archiving Gmail messages or selecting the next/previous message in the Message Viewer are only available when run outside of the App Sandbox.

## Post-Installation

Once and if MsgFiler Filing Script has been installed and enabled, MsgFiler 4's title bar will change to read MsgFiler + Filing Script.

<div><figure><img src="https://4639002-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTVWOEW6NaDJ95yKpBphJ%2Fuploads%2FjTltlJIcs13foCC9E8r3%2Fbefore-filing-script-430.png?alt=media&#x26;token=54ec7e4f-84f2-4407-a6ab-dcd0fdcf5df0" alt=""><figcaption></figcaption></figure> <figure><img src="https://4639002-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTVWOEW6NaDJ95yKpBphJ%2Fuploads%2FGi3hjum6P7GrHULfoGe2%2Fafter-filing-script-430.png?alt=media&#x26;token=51eb7778-44ca-4681-9f81-3cad0db574ab" alt=""><figcaption></figcaption></figure></div>

## Automation Permission

If you install the MsgFiling Filing Script, an additional Automation prompt will appear asking you to grant MsgFiler 4 access to control System Events. This is required in order for the MsgFiler Filing Script to work properly.

<div align="center"><figure><img src="https://4639002-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTVWOEW6NaDJ95yKpBphJ%2Fuploads%2Fgd5qTcHilXTXyLeC8rsr%2Fautomation-system-events.png?alt=media&#x26;token=f99c7daa-6729-40d6-99bc-ace97e661219" alt=""><figcaption><p>You must allow MsgFiler 4 to control System Events in order for the Filing Script to work properly.</p></figcaption></figure></div>

## Re-installing the Script

At any point, you can re-install the MsgFiler Filing Script by following these steps:

1. Open **MsgFiler 4**.
2. Choose **Settings…** from the **MsgFiler 4** menu.
3. Click **Filing**.
4. Click **Installation Guide….**

<figure><img src="https://4639002-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FTVWOEW6NaDJ95yKpBphJ%2Fuploads%2F43H5b7FyDv6ZhGnQue5b%2Fsettings-filing-script-activated-430.png?alt=media&#x26;token=ed04a780-cf6b-4525-ad80-6a1bf8228834" alt=""><figcaption></figcaption></figure>

5. MsgFiler 4 will display a dialog with instructions on how to download the MsgFiler Filing Script disk image.
6. Open the disk image.
7. Navigate to the following directory: `~/Library/Application Scripts/com.atow.MsgFiler4`
8. Copy the **MsgFiler Filing.scpt** file into the folder that comes up.

{% hint style="info" %}
If and when there are updates to the MsgFiler Filing Script, MsgFiler will prompt you to update the script as well.
{% endhint %}
