# 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?](/using-msgfiler/msgfiler-filing-script/why-a-separate-script.md)) 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](/using-msgfiler/msgfiler-filing-script/why-a-separate-script.md).
{% endhint %}

## Installation

Installation of the MsgFiler Filing Script is covered in the [Filing Script](/onboarding/filing-script.md) 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="/files/kHKvQUf8QzV9fe37GkiA" alt=""><figcaption></figcaption></figure> <figure><img src="/files/pkXSYzCrA79P2BXQdkvD" 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="/files/oYPKtVZnefcbrcr0ZF2Y" 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="/files/ayBkmCXNuKRwnKCBb5Vn" 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 %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.msgfiler.com/using-msgfiler/msgfiler-filing-script.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
