# OnBeforeFolderChange

The **OnBeforeFolderChange** event can be implemented by a [script add-in](../../../scripting/script_add-ins) to receive notification before a new folder is read in a tab. Use the **OnAfterFolderChange** event if you want notification _after_ a folder has been read.

| **Method Name:**   | OnBeforeFolderChange                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Argument Type:** | [**BeforeFolderChangeData**](../scripting_objects/beforefolderchangedata)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| **Return Type:**   | _bool_ or _string_                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| **Description:**   | <p>The <strong>BeforeFolderChangeData.tab</strong> property identifies the tab, and the <strong>path</strong> property identifies the folder about to be read. The <strong>initial</strong> property indicates if this is the first folder read into this tab - if <strong>True</strong>, it means the tab was previously empty or newly opened.</p><p>You can return two different types from this event:</p><ul><li><em>bool</em>: If you return <strong>True</strong>, the folder read will be blocked and the tab will be unchanged. If you return <strong>False</strong> the read will be allowed to continue (this is the default).</li><li><em>string</em>: You can return a <em>string</em> (or a <a href="../scripting_objects/path"><strong>Path</strong></a> object) to change the folder path to be read.</li></ul> |
